xml - Android: How to make textview visible with padding -
i want create , have used drawable along textview in it:
but not getting textview in center nor whole text visible due padding. how make changes existing code this. don't want image , text , buttons.
rounded_edge.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#ffffff"/> <stroke android:width="5dp" android:color="#000000"/> <!--<padding android:left="30dp" android:top="350dp" android:right="250dp" android:bottom="10dp"/>--> <gradient android:startcolor="#d2e0e2" android:endcolor="#d2e0e2"/> <corners android:bottomrightradius="5dp" android:bottomleftradius="5dp" android:topleftradius="5dp" android:toprightradius="5dp"/> </shape>
yelp_biz_detail.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:layout_centerinparent="true" > <textview android:id="@+id/textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/rounded_edge" android:layout_margintop="30dp" android:layout_marginleft="30dp" android:layout_marginright="30dp" android:paddingleft="30dp" android:paddingtop="350dp" android:paddingright="250dp" android:paddingbottom="10dp"/> android:textalignment="center" android:gravity="center" /> </linearlayout>
solution :
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:layout_centerinparent="true" > <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:layout_margintop="30dp" android:layout_marginleft="30dp" android:layout_marginright="30dp" android:layout_marginbottom="150dp" android:background="@drawable/rounded_edge" > <textview android:id="@+id/textview" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="30dp" android:paddingtop="30dp" android:paddingright="25dp" android:paddingbottom="10dp" android:textallcaps="true" /> </linearlayout> </linearlayout>
i think mean 35dp instead of 350dp in android:paddingtop="350dp"
, 25dp instead of 250dp in android:paddingright="250dp"
in yelp_biz_detail.xml
file