【发布时间】:2010-05-13 22:10:57
【问题描述】:
在我的 Android 应用程序中,我有一个标签式 Activity。在其中一个标签中,我有两个TextViews 和两个EditTexts。
第一个EditText 只有一行,没关系。但是,我希望另一个EditText、android:id="@+id/paste_code" 占用剩余空间,但无论我对它做什么,它都只会显示一行。我不想手动设置行数,因为适合屏幕的行数因设备而异。
这是相关代码。它嵌套在标签式Activity 的所有必要组件中。
<ScrollView
android:id="@+id/basicTab"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Paste title"
android:layout_weight="0" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/paste_title_hint"
android:id="@+id/paste_title"
android:lines="1"
android:gravity="top|left"
android:layout_weight="0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Paste text"
android:layout_weight="0" />
<EditText
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:hint="@string/paste_hint"
android:id="@+id/paste_code"
android:gravity="top|left"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>
【问题讨论】:
标签: android