<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" > <Button
android:id="@+id/buttonLeft"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="buttonLeft" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/button3"
android:text="Button2" /> <Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Button3" /></RelativeLayout>我要的是左边的按钮只是占用当前行的剩余空间
要怎么写呢?簇
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" > <Button
android:id="@+id/buttonLeft"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="buttonLeft" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/button3"
android:text="Button2" /> <Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Button3" /></RelativeLayout>我要的是左边的按钮只是占用当前行的剩余空间
要怎么写呢?簇
解决方案 »
- ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0)是什么类型的?
- Android 关闭软键盘
- android没见过的异常
- 如何将应用程序图标放在menu中
- findViewById的一个问题
- android 入门问题急求助
- 怎样把canvas中画的保存到本地啊?
- 如何获取下面信息中的指定某个值?
- android 通过HID与PC通信
- 如何批量向SQLITE数据库存储大量图片数据?
- android developer tools打开后,又自动关闭了,不知道是什么原因?求指点
- 请教:Android下怎样让Activity的一部分用于画图而不占用整个Activity 另一部分显示其他控件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" > <Button
android:id="@+id/buttonLeft"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="buttonLeft" /> <Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button2" /> <Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button3" /></LinearLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <LinearLayout
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_marginLeft="1dp"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn1" /> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn2" />
</LinearLayout> <Button
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/right"
android:text="godbtn"
/>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/buttonLeft"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<!--只需要加这一行就可以实现-->
android:layout_toLeftOf="@+id/button2"
android:text="buttonLeft" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/button3"
android:text="Button2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Button3" />
</RelativeLayout>