Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使文本视图占用所有屏幕空间_Android_Android Layout - Fatal编程技术网

Android 如何使文本视图占用所有屏幕空间

Android 如何使文本视图占用所有屏幕空间,android,android-layout,Android,Android Layout,我有一个包含文本视图的线性布局,如下所示: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:gravity="left|center" android:layout_width="fill_parent"

我有一个包含文本视图的线性布局,如下所示:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_height="wrap_content" 
               android:gravity="left|center"
               android:layout_width="fill_parent" 
               android:paddingBottom="5px"
               android:background="@drawable/drawable_corners_in"
               android:paddingTop="5px" 
               android:paddingLeft="5px">

     <TextView android:id="@+id/i_am_too_small"
           android:textSize="18sp"
           android:background="#FFFFFF"
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content"
           android:autoLink="web|email|phone|map|all" 
                   android:layout_marginBottom="2px" 
                   android:layout_marginTop="2px">
      </TextView>
</LinearLayout>

当屏幕显示时,TextView是屏幕顶部的一个白色条。这是一个字符高,并在整个屏幕上延伸。随着文本的添加,它会在屏幕上向下延伸

文本视图下方的屏幕其余部分为黑色

我希望TextView显示并立即使用整个屏幕高度,以便整个屏幕为白色。没有黑色的


有人做过类似的事情吗?

尝试将视图中的布局高度从wrap\u content更改为match\u parent

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_height="match_parent" 
           android:gravity="left|center"
           android:layout_width="fill_parent" 
           android:paddingBottom="5px"
           android:background="@drawable/drawable_corners_in"
           android:paddingTop="5px" 
           android:paddingLeft="5px">

 <TextView android:id="@+id/i_am_too_small"
       android:textSize="18sp"
       android:background="#FFFFFF"
       android:layout_width="wrap_content" 
       android:layout_height="match_parent"
       android:autoLink="web|email|phone|map|all" 
               android:layout_marginBottom="2px" 
               android:layout_marginTop="2px">
  </TextView>
</LinearLayout>

只需将
填充到所有布局宽度和高度即可

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_height="fill_parent" 
           android:gravity="left|center"
           android:layout_width="fill_parent" 
           android:paddingBottom="5px"
           android:background="@drawable/drawable_corners_in"
           android:paddingTop="5px" 
           android:paddingLeft="5px">

 <TextView android:id="@+id/i_am_too_small"
       android:textSize="18sp"
       android:background="#FFFFFF"
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent"
       android:autoLink="web|email|phone|map|all" 
               android:layout_marginBottom="2px" 
               android:layout_marginTop="2px">
  </TextView>


@user1126515移除线性布局的所有填充物,然后填充相同的填充物。TextView的大小仅与其中当前的文本量相同。ArrayAdapter用文本填充它有关系吗?这是listview项的布局???如果是,则可以填充整个屏幕,不涉及listview。我有我发布的xml。填充它的代码使用ArrayAdapter并用一些字符串加载它,这些字符串是存储在ArrayList中的对象中的字段。@user1126515能否上载结果的图片