【发布时间】:2016-01-26 03:26:12
【问题描述】:
嘿,我如何在 recyclerview 中隔开项目,我目前在 java 中使用数组来提供图像和对象的名称,但是,它不允许我使用填充来隔开列表中的项目? ?
<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>
这是我的 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;
}
【问题讨论】:
标签: java android material-design