I'm trying to set a divider to be used in a list for my app. I have made the XML code for the "dicedivider" as shown below
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1px"
android:color="@color/divider_Color"
/>
</shape>
Then I am trying to set it as the divider drawable for my LinearLayout as shown below
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
diceCount = 0;
diceList = (LinearLayout) this.findViewById(R.id.main_Dice_List);
diceList.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
diceList.setDividerDrawable(this.getResources().getDrawable(R.drawable.dicedivider));
diceList.setDividerPadding(5);
addDice();
}
Regardless of this though the app shows no dividers. I've even tried embedding it directly into the XML and not had any luck.
I'm very new at Android coding. Any idea where I'm going wrong?