I am new to Android development and I have a question about setting weight in a linear layout. I am trying to create a row with two custom buttons and a custom edit text. The edit text should only take up as much room as its content, and the two buttons should expand horizontally to […]
I have a horizontal LinearLayout containing a TextView followed by a Spinner next to it. This LinearLayout is dynamically inflated multiple times in a fixed vertical LinearLayout contained within a RelativeLayout. The problem is that since I switched from Theme.light to Theme.holo.light, the last line of the TextView gets cut in half. This happens when […]
By default android checkbox shows text at right side and checkbox at left I want to show checkbox at right side with text at left how do I achieve this?
How can I have one layout for landscape and one for portrait? I want to assume extra width and conserve vertical space when the user rotates the phone over sideways.
How can I size a view based on the size of its parent layout. For example I have a RelativeLayout that fills the full screen, and I want a child view, say an ImageView, to take up the whole height, and 1/2 the width? I’ve tried overriding all on onMeasure, onLayout, onSizeChanged, etc and I […]
I have a weird behavior I can’t pinpoint the source of. I have my app with the classic requestWindowFeature(Window.FEATURE_NO_TITLE); to remove the title/status bar. I then create a Dialog box to allow the user to enter information (name etc) With a physical keyboard, no problem but when I use the virtual keyboard I have a […]
I want to show a button under a ListView. Problem is, if the ListView gets extended (items added…), the button is pushed out of the screen. I tried a LinearLayout with weights (as suggested in Android: why is there no maxHeight for a View?), but either I got the weights wrong or it simply didn’t […]
When I run layout on a specific XML file, I get this: This tag and its children can be replaced by one <TextView/> and a compound drawable What change should be done for the following xml code: <LinearLayout android:id=”@+id/name_layout” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:gravity=”center_vertical” android:background=”@drawable/grouplist_single_left_grey_area” > <ImageView android:id=”@+id/photo_image” android:layout_width=”@dimen/thumbnail_width” android:layout_height=”@dimen/thumbnail_height” android:paddingBottom=”5dip” android:paddingTop=”5dip” android:paddingRight=”5dip” android:paddingLeft=”5dip” android:layout_marginRight=”5dip” android:clickable=”true” android:focusable=”true” […]
Why is this line needed in xml layout file? xmlns:android=”http://schemas.android.com/apk/res/android”
I have a RelativeLayout inside a ScrollView. My RelativeLayout has android:layout_height=”match_parent” but the view doesn’t take the entire size, it’s like a wrap_content. Is there a way to have the real fill_parent/match_parent behavior ? My layout : <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <ImageView android:id=”@+id/top” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_alignParentTop=”true” android:scaleType=”fitXY” android:src=”@drawable/top” /> <ImageView android:id=”@+id/header” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_below=”@+id/top” android:scaleType=”fitXY” […]