我希望文本视图覆盖整个屏幕

时间:2014-02-27 17:52:46

标签: android textview

我希望我的TextView覆盖整个屏幕并覆盖该XML文件中的所有组件。我怎样才能做到这一点?

我尝试将fill_parent设置为android:layout_widthandroid:layout_height,但它不起作用。

2 个答案:

答案 0 :(得分:1)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="fill_parent"
        android:text="TextView" />

</RelativeLayout>

enter image description here

答案 1 :(得分:0)

您可能在父级中设置了填充。 match_parent更现代一些:)

相关问题