Hey how do I space out items in a recyclerview, I am currently using an array in java to provide the images and the names of the objects, however, it wont let me use padding to space out the items in my list??
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.athena.athenafront.NavigationFragment"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@android:color/white">
<!-- TODO: Update blank fragment layout -->
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primaryColor"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/drawer_recyclerview"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:choiceMode="singleChoice"
android:dividerHeight="0dp"
android:background="#ffff"
android:layout_height="400dp">
</android.support.v7.widget.RecyclerView>
Here is my java
public static List<AthenaPanel> getData() {
//created an object for ur Drawer recyclerview array
List<AthenaPanel> data= new ArrayList<>();
//this is where you would add all your icons for the drawer list
//arrays of icons
int[] icons={R.mipmap.ic_launcher};
String[] titles = {"Explore","Myprofile","MyStatus","Calendar","Setting","Send FeedBack"};
//this is our for loop to cycle through the icons and the titles
for(int i=0;i<5;i++){
AthenaPanel current=new AthenaPanel();
//i%().length allows ups to loop over the array any number of times we want to
current.iconId=icons[i%icons.length];
current.title=titles[i%titles.length];
data.add(current);
}
return data;
}