relativelayout

Android Layout_weight

拟墨画扇 提交于 2020-01-03 21:08:15
问题 Maybe I misunderstood the layout_weight parameter but I can't get it why something like this is not working... <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="1"> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TextView" android

Android Layout_weight

北城以北 提交于 2020-01-03 21:08:05
问题 Maybe I misunderstood the layout_weight parameter but I can't get it why something like this is not working... <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="1"> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TextView" android

Dynamically load layout in Android

巧了我就是萌 提交于 2020-01-03 04:49:09
问题 My application requires 2 screens and for this I have created two different XML layout files using RelativeLayout . One layout file loads whenever I run my Activity. Now I want to load the second layout on to the same Activity , when user click on a button in OptionsMenu and also when user press Back button the first screen loads instead of exiting the application. So that i don't need to create another Intent in my application. 回答1: Ideally there should be two different activities present in

Change ImageView size programmatically

落花浮王杯 提交于 2020-01-02 21:25:21
问题 I have a relative layout with 3 ImageViews. The first one is a square image, the second is just used for spacing, and the third one is another square image. Here is the xml code for that layout: <?xml version="1.0" encoding="UTF-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/radioSV" android:layout_width="fill_parent" android:layout_height="wrap_content"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width

Using a RelativeLayout to vertically split two fragments evenly

我们两清 提交于 2020-01-02 08:43:18
问题 I am trying to create a simple layout with three fragments. On the left, I want two fragments over eachother, each taking 50% of the height of the screen. On the right, I want one large container fragment, like this: +-----+-----------------+ | f1 | detail_container| | | | +-----+ | | f2 | | | | | +-----+-----------------+ I got it working with two LinearLayouts , using layout_height="0dp" and layout_weight="1" , but I got the message it is bad for performance, so I set out to use a

Using a RelativeLayout to vertically split two fragments evenly

青春壹個敷衍的年華 提交于 2020-01-02 08:42:09
问题 I am trying to create a simple layout with three fragments. On the left, I want two fragments over eachother, each taking 50% of the height of the screen. On the right, I want one large container fragment, like this: +-----+-----------------+ | f1 | detail_container| | | | +-----+ | | f2 | | | | | +-----+-----------------+ I got it working with two LinearLayouts , using layout_height="0dp" and layout_weight="1" , but I got the message it is bad for performance, so I set out to use a

Find the position of a bitmap in android imageview when container view scaled centerInside

谁说我不能喝 提交于 2020-01-02 06:06:59
问题 I have an RelativeLayout that contains a custom ImageView, the scaleType="centerInside", I load in a bitmap (usually smaller than the imageView). How can I get the top/left position of where the bitmap was drawn? I need to be able addView's on top a positions relative to the bitmap. RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.scroll_scaled, container, false); ContentImageView image = (ContentImageView) view.findViewById(R.id.base_page); Bitmap bm = mInterfaceActivity

RelativeLayout differences between 1.5 and 2.1

核能气质少年 提交于 2020-01-01 12:13:18
问题 I've got a ListView with items composed of RelativeLayouts. This is the relevant XML from the list items: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/xx" android:gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout

How do I achieve the following result using RelativeLayout?

最后都变了- 提交于 2020-01-01 05:03:06
问题 Pictures: http://img838.imageshack.us/img838/1402/picse.png How do I make the layout in Pic. 2 using RelativeLayout ONLY. Below is the xml layout of the first screenshot. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/timer_textview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center

Android RelativeLayout fill_parent unexpected behavior in a ListView with varying row heights

﹥>﹥吖頭↗ 提交于 2019-12-30 06:53:32
问题 I'm currently working on a small update to a project and I'm having an issue with Relative_Layout and fill_parent in a list view. I'm trying to insert a divider between two sections in each row, much like the divider in the call log of the default dialer. I checked out the Android source code to see how they did it, but I encountered a problem when replicating their solution. To start, here is my row item layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id