简体   繁体   中英

Change textview background color width

I have a problem that I explain better with this images:

Now I have this:

我有的

But I want this:

我想要的是

I want to have the background color of my textview stretch on all the width of the screen, but I don't know how to do it. Can someone help me?

Thanks! :)

Use match_parent as the width :

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM