无法解析符号“ list_items”

时间:2019-10-02 13:37:14

标签: android

我已经将布局资源名称创建为list_items,那么为什么会出错? 在res文件夹中 谁能帮我解决这个问题

谢谢 我不知道这是要我添加更多详细信息 所以这里有一些细节,但是请帮助解决问题

 public class ListViewAdapter extends ArrayAdapter<Model> {


        List<Model> modelList;
        Context context;

        public ListViewAdapter(Context context, int resource, List<Model> modelList, Context context1) {
            super(context, resource);
            this.modelList = modelList;
            this.context = context1;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            //  return super.getView(position, convertView, parent);
            LayoutInflater inflater = LayoutInflater.from(context);
            View listViewItem = inflater.inflate(R.layout.list_items, null, false);

            TextView textViewName = listViewItem.findViewById(R.id.title);
            TextView textViewImageUrl = listViewItem.findViewById(R.id.description);

            //Getting the hero for the specified position
            Model model = modelList.get(position);

            //setting hero values to textviews
            textViewName.setText(model.getTitle());
            textViewImageUrl.setText(model.getDescription());

            //returning the listitem
            return listViewItem;

        }
    }

list_items.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:src="@mipmap/ic_launcher_round" />

</RelativeLayout>

0 个答案:

没有答案