I am working on an android project and I have a LinearLayout which contains 2 horizontal buttons using borderless button style.
I am trying to show dividers in between each button but they are not showing up but I can't see any reason why not. Below is the XML layout:
<LinearLayout android:id="@+id/call_log_select_host_button_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:divider="#ffffff"
android:showDividers="middle"
android:dividerPadding="22dp">
<Button android:id="@+id/call_log_select_btnCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel"
style="?android:attr/borderlessButtonStyle" />
<Button android:id="@+id/call_log_select_btnBlock"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Block"
style="?android:attr/borderlessButtonStyle" />
</LinearLayout>
Thanks for any help you can provide.
Create a file mydivider.xml
inside res/drawable
and put the following shape
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="1dip" />
<solid android:color="#ffffff" />
</shape>
add the shape as divider for your layout
<LinearLayout android:id="@+id/call_log_select_host_button_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:divider="@drawable/mydivider"
android:showDividers="middle"
android:dividerPadding="22dp">
<Button android:id="@+id/call_log_select_btnCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel"
style="?android:attr/borderlessButtonStyle" />
<Button android:id="@+id/call_log_select_btnBlock"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Block"
style="?android:attr/borderlessButtonStyle" />
</LinearLayout>
or as workaround:
<LinearLayout android:id="@+id/call_log_select_host_button_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:divider="@drawable/mydivider"
android:showDividers="middle"
android:dividerPadding="22dp">
<Button android:id="@+id/call_log_select_btnCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel"
style="?android:attr/borderlessButtonStyle" />
<View android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#ffffff" />
<Button android:id="@+id/call_log_select_btnBlock"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Block"
style="?android:attr/borderlessButtonStyle" />
</LinearLayout>