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:
this works fine when text length long but, when text contains more 1 line , not in full width, becomes below image:
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
Post a Comment