Я хочу создать горизонтальное представление корзины, и я написал этот код:
в основной деятельности xml
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" >
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
А это класс адаптера
public class AdapterNote extends ArrayAdapter<StructCategory> {
public AdapterNote(ArrayList<StructCategory> array) {
super(G.context, R.layout.adapter_category, array);
}
private static class ViewHolder {
public TextView txtTitle;
public ViewHolder(View view) {
txtTitle = (TextView) view.findViewById(R.id.cat_txt);
}
public void fill(final ArrayAdapter<StructCategory> adapter, final StructCategory item, final int position) {
txtTitle.setText(item.title);
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
StructCategory item = getItem(position);
if (convertView == null) {
convertView = G.inflater.inflate(R.layout.adapter_category, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.fill(this, item, position);
return convertView;
}}
Ву функции setadapter MainClass setadapter есть ошибка: Тип android.support.v4.view.NestedScrollingChild2 не может быть разрешен.На него косвенно ссылаются необходимые файлы .class
Я импортировал поддержку v4 api 20 и v7compat v20 и v7 recycleview api 20, но не работает мой код
LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
RecyclerView myList = (RecyclerView) findViewById(R.id.my_recycler_view);
myList.setLayoutManager(layoutManager);
adapter = new AdapterNote(G.tasksCategory);
myList.setAdapter(adapter);
, и я создаю xml для класса адаптера:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:padding="8dip" android:gravity="right">
<TextView
android:id="@+id/cat_txt"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/category_txt"
android:gravity="center_vertical|center"
android:text="TextView"
android:textColor="#000" />
</LinearLayout>
, пожалуйста, помогите мне с этой проблемой