我的应用布局,整体上是一个LinearLayout, 如下面这样,每个控件占一行。可是我希望,有些Lable和输入控件本身,如下面的:作为Lable的TextView和EditText,能放在同一行,左右排列。
因为这样,一是更省画面空间,二是也更符合传统习惯。
不知该怎么修改Layout文件?请高手TX指点。
<LinearLayout android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
android:id="@+id/viewPage1"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/label_income_amount"
android:layout_marginTop="5sp"> </TextView> <EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/src_amount"
android:hint="@string/src_amount_hint"/>
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/label_discount_amount"> </TextView> <EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/src_amount_discount"
android:hint="@string/src_amount_hint"/> ......</LinearLayout>
因为这样,一是更省画面空间,二是也更符合传统习惯。
不知该怎么修改Layout文件?请高手TX指点。
<LinearLayout android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
android:id="@+id/viewPage1"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/label_income_amount"
android:layout_marginTop="5sp"> </TextView> <EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/src_amount"
android:hint="@string/src_amount_hint"/>
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/label_discount_amount"> </TextView> <EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/src_amount_discount"
android:hint="@string/src_amount_hint"/> ......</LinearLayout>
解决方案 »
- android:launchMode="singleTask"和startActivityForResult的疑惑
- 请问下..android怎么获取账户和同步的状态
- 配置文件出错?Unknown C compiler arm-linux-androideabi-gcc ?
- 帮我看看我的wifi连接代码那里出错了,急!!!!!!!!
- 请问如何在代码里设置USB调试模式
- android应用运行报错
- 用imageloader异步加载图片的问题,怎么实现只加载当前屏幕内的图片
- 求解决
- android的手势类simpleongesturelistener双指旋转如何判断?
- 安卓SDK无法安装
- 求大神指导视频播放器开发的相关经验
- 求高手,Notification动态布局的问题
android:layout_width="fill_parent"
android:orientation="vertical"
android:id="@+id/viewPage1"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="horizontal"
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/label_discount_amount"> </TextView> <EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/src_amount_discount"
android:hint="@string/src_amount_hint"/>
</LinearLayout>
......</LinearLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" > <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LeftButton" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" > </LinearLayout> <Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RightButton" />
</LinearLayout>
这样可以达到左右对齐的效果~~~~~~~~~~~~