<?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>我要的是左边的按钮只是占用当前行的剩余空间
要怎么写呢?簇
解决方案 »
- 初级HelloWorld问题
- 在adb shell下直接执行可以加载起来的服务,在NDK下用system命令跑不起来,怪!
- andriod下,模拟器里,运行效果很好,但是放到自己设备上,控件位置有改变,向左上角拥挤些了。但也不是挤到一起,就是不那么均匀了,不知道哪里的分辨率有问题?
- Android nvflash中flash.cfg的配置档案解析
- Android程序在手机里,按钮不起作用
- Image_View startAnimation的问题
- 求助!!Mastudio开发菜鸟级问题:如何使手机通过登录方式连接到电脑
- android使用GoogleMap,如何获取到当前位置或特定位置的经纬度
- Android Service用getInstance的方式获取实例可以吗?
- ScrollView和VerticalViewPager的滑动冲突
- 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>