如题,我想在一行里,先放个文本框,再放个固定宽度的按钮。文本框宽度填满剩余的空间,能实现吗?
解决方案 »
- 有谁曾用ant把src打成一个jar包吗
- 智能终端开发接口
- 在android2.3中,关于Service(服务)被休眠的问题
- 动态增加listview中的列表项,怎么不能传参数进去?
- Android 3G新一代智能手机开发技术学习辅导!
- 关于点击事件?
- 在线求助一个带渐变,阴影效果的png图片的问题!
- 在程序里怎么能跳到无线控件呢?
- setBackgroundResource导致界面消失的问题
- zxing 二维码扫描 添加了一个打开闪光灯的功能,但是闪关灯打开后摄像头被闪光灯占用,屏幕就卡住了,不能扫描二维码了
- android删除联系人-------标题要长
- android 官方给出的最适合开发android的eclipse版本是哪个
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
> <EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_toLeftOf="@+id/button1" >
</EditText> <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
<?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"
> <EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/button1" >
</EditText> <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Button" />
</RelativeLayout>
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_toLeftOf="@+id/button1" >
</EditText>
注意layout_weight="1"就是布局比重的重点。
设为1就代表占父的1/5 设为5就全占 ;但是若还有其他的子和他并列,就会占父的全部 ,但是会给另外的子留下一部分空间来显示。