【发布时间】:2013-09-17 16:21:23
【问题描述】:
我刚开始android开发,所以我有两个问题
首先,为什么编辑字段的大小不会改变它的
width。其次,这两行是什么意思
android:layout_weight="1.0"
android:ems="50"
当我在布局表单android:layout_weight= 中使用时,它的值是0.1,为什么?
在现场需要1.0,为什么?
ems 是什么?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/login_header"
android:gravity="center_horizontal"
android:textSize="30dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp" >
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/username"
android:textSize="18dp"/>
<EditText
android:id="@+id/username"
android:layout_width="5dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:ems="50"
android:inputType="text"/ >
</LinearLayout>
<Button
android:id="@+id/login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/login_header"
android:layout_margin="10dp"/>
</LinearLayout>
【问题讨论】: