TextView的" FILL_PARENT"不填父 [英] TextView "fill_parent" does not fill the parent

查看:115
本文介绍了TextView的" FILL_PARENT"不填父的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的布局:

<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>

但我的TextView不采取一切,即使我做FILL_PARENT宽度。我怎样才能使其与全尺寸的内容只是大小?

But my TextView is not taking all of the width even though I did fill_parent. How can I make it's with full size instead of just the size of the content?

推荐答案

请外的LinearLayout match_parent 而不是 WRAP_CONTENT 中的属性的android:layout_width 的android:layout_height

Make the outer LinearLayout to have match_parent instead of wrap_content in the attributes android:layout_width and 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" >

这篇关于TextView的&QUOT; FILL_PARENT&QUOT;不填父的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆