android-ui

How to align LinearLayout at the center of its parent?

独自空忆成欢 提交于 2019-11-27 17:22:24
I've looked through numerous similar questions here at SO, but nothing helps. I have a hierarchy of different nested layouts, all have android:layout_width="fill_parent" , and the inner-most layout has android:layout_width="wrap_content - I need to align it at the center (horizontally). How do I do that? Update: : I've found the cause of the problem - if I put the inner LinearLayout into RelativeLayout with android:layout_width="fill_parent" , it still wraps it's content. The TableRow, however, is really filling the screen. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=

Multi Colour progress bar

放肆的年华 提交于 2019-11-27 16:28:51
I want to create a progress bar (intermediate progress bar) similar to gmail app which change colours.I am able to this by keeping and updating progress_indeterminate_horizontal.xml from sdk/platforms. I don't want to use animation (multi colour images). I want to achieve this using xml (i want use gradient). Any help will be appreciated. Thanks in advance JASON G PETERSON Here's my implementation: Draws an animated rainbow gradient. Cool, if I do say so myself. It's not XML-based, but could be made to be, and it does use gradients. Perhaps it will give you some ideas. Setup: pb = (ProgressBar

Cancel Done buttons in Calendar App - Is it part of Action Bar?

北城以北 提交于 2019-11-27 14:02:59
问题 Hi, I'm refering the Cancel/Done button in Calendar app. These 2 buttons are pinned on the top, and they are always visible, even if you scrolling the bottom "form". May I know, is it part of Action Bar? If so, how should the implementation look like? 回答1: Remember that Android is open source, and most apps preinstalled on an android device running aosp are open source. Here's the project: https://github.com/android/platform_packages_apps_calendar Yes, it is a custom ActionBar setup, here's

Android getMeasuredHeight returns wrong values !

筅森魡賤 提交于 2019-11-27 12:19:43
I'm trying to determine the real dimension in pixels of some UI elements ! Those elements are inflated from a .xml file and are initialized with dip width and height so that the GUI will eventually support multiple screen size and dpi ( as recommended by android specs ). <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="150dip" android:orientation="vertical"> <ImageView android:id="@+id/TlFrame" android:layout_width="110dip" android:layout_height="90dip" android:src="@drawable/timeline_nodrawing" android:layout

Difference between MotionEvent.getRawX and MotionEvent.getX

时光怂恿深爱的人放手 提交于 2019-11-27 11:52:43
I would like to know The difference between MotionEvent.getRawX and MotionEvent.getX in android as one is numeric and the other is float?Whats the need to have both of these types? MotionEvent will sometimes return absolute X and Y coordinates relative to the view, and sometimes relative coordinates to the previous motion event. getRawX() and getRawY() that is guaranteed to return absolute coordinates, relative to the device screen. While getX() and getY() , should return you coordinates, relative to the View, that dispatched them. => rawX = motionEven.getX() + touchableButton.getX() + layout3

Getting DrawerLayout to Slide over the ActionBar

浪尽此生 提交于 2019-11-27 10:57:43
I have a sliding drawer menu in an activity, which has an actionbar with some tabs on it. I'd like to get the sliding drawer to slide over the tabs , not below them. This is what it looks like right now... Any ideas on how this could be done? Note: I understand that I might be breaking some conventions and UI patterns here, and if it does not work at all, I'll look at alternatives. But I'd like to get this working first. EDIT: See the below screen shot of the Google Play Music app that does exactly what I need. See @CommonsWare's answer below where he does agree that I might be breaking

remove border, padding from Dialog

白昼怎懂夜的黑 提交于 2019-11-27 10:33:21
问题 I have an activity which is with the theme Theme.Transparent which is: <style name="Theme.Transparent" parent="android:Theme.Dialog"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">false</item> <item name="android:windowIsFloating">true</item> <item name="android:backgroundDimEnabled">false</item> <item name="android:gravity">top</item> </style> i'm trying to get rid of the border and the padding around it.. i want to make fill the horizontal of the

runOnUiThread vs Looper.getMainLooper().post in Android

随声附和 提交于 2019-11-27 10:07:12
Can anyone tell me if there's any difference between using runOnUiThread() versus Looper.getMainLooper().post() to execute a task on the UI thread in Android?? About the only thing I can determine is that since runOnUiThread is a non-static Activity method, Looper.getMainLooper().post() is more convenient when you need to code something in a class that can't see the Activity (such as an interface). I'm not looking for a discussion on WHETHER something should be executed on the UI thread, I get that some things can't and a great many things shouldn't, however some things (like starting up an

How to move main content with Drawer Layout left side

£可爱£侵袭症+ 提交于 2019-11-27 10:02:50
Just checked how to make menu with DrawerLayout here . But left side menu is moving on the front of main content. How can I set it to menu and main content move side by side(menu is pushing content to the right)? If you dont want to use third-party libraries , you can implement it yourself just overriding the onDrawerSlide from the ActionBarDrawerToggle. There you can translate your framelayout view based on the opening % of your drawer. Example with code: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"

Why Activity is hanging while coming back from another activity's few fragments?

孤街浪徒 提交于 2019-11-27 08:45:38
问题 I have two activities Activity A and B, Activity A has 3 fragments namely a1,a2 and a3. a3 is the default selected fragment which shows videos, a2 contains one big textView and a small edittext in it and a1 contains a listview. Now On activity A's title bar I have a button, and since it is on title bar it is visible from all 3 fragments. OnClick of this button I open Activity B. using Following function. public void inviteUser() { if ( getUserType() == ACTIVE ) { Intent intent = new Intent