java - Full width android textView -


i new android , developing card making application. want add feature in app enables user apply background color textview full width. need below image: enter image description here

this works fine when text length long but, when text contains more 1 line , not in full width, becomes below image:

enter image description here

i need result same first image no matter how long text is. in textview have used wrap_content height width. need apply background textview in full display width if textview letter only. hope clear. thanks

try set textview width match_parent.

android:layout_width :-> specifies basic width of view.

sample code

<textview      android:layout_width="match_parent"  android:layout_height="wrap_content" /> 

or set layoutparams of textview programatically this

layoutparams my_params = new linearlayout.layoutparams(layoutparams.match_parent, layoutparams.wrap_content, 1f);     textview.setlayoutparams(my_params); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -