5 android textview android-layout android-linearlayout android-xml
我有一个简单的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
但即使我填写了fill_parent,我的TextView也没有占用所有的宽度.如何使用完整尺寸而不仅仅是内容的大小?
使外部LinearLayout具有match_parent而不是wrap_content属性android:layout_width和android:layout_height.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6569 次 |
| 最近记录: |