Android: Padding not working in RelativeLayout -
i want have padding between description text , switch paddingright property not working. why?
<relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/layoutlayout" android:layout_below="@+id/layoutheader" android:layout_margintop="15dp" android:layout_marginleft="15dp" android:layout_marginright="15dp"> <switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/widgetshortswitch" android:layout_centervertical="true" android:layout_alignparentright="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="this long description text should not overlay." android:textcolor="#000000" android:paddingright="15dp" android:id="@+id/widgetshorttextview" android:layout_centervertical="true" android:layout_alignparentleft="true" /> </relativelayout>
try this...
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/layoutheader" android:layout_marginleft="15dp" android:layout_marginright="15dp" android:layout_margintop="15dp" android:weightsum="1"> <textview android:id="@+id/widgetshorttextview" android:layout_width="0" android:layout_height="wrap_content" android:paddingbottom="5dp" android:layout_weight="0.85" android:paddingright="15dp" android:text="this long description text should not overlay." android:textcolor="#000000" /> <switch android:id="@+id/widgetshortswitch" android:layout_width="0" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_centervertical="true" android:layout_weight="0.15" /> </linearlayout>
Comments
Post a Comment