Android开发日志(3)

------------恢复内容开始------------

CardView+Searchview

1.进入gradle中导入

implementation ‘androidx.recyclerview:recyclerview:1.1.0‘
implementation ‘androidx.cardview:cardview:1.0.0‘

2.修改activity_main.xml

3.new->layoutresoucefile:

 

Android开发日志(3)

 

 设置

cardCornerRadius="4dp"

4.New->javaclass->ExampleItem

5.

package com.example.recyclerviewproject;

public class ExampleItem {
    private int mImageResource;
    private String mText1;
    private String mText2;

    public ExampleItem(int imageResource, String text1, String text2){
        mImageResource = imageResource;
        mText1 = text1;
        mText2 = text2;

    }

    public int getmImageResource(){
        return  mImageResource;
    }

    public String getmText1(){
        return mText1;
    }
    public String getmTExt2(){
        return mText2;
    }

}

6.创建newcalss

Android开发日志(3)

 

 Caution1!:androidx导入recyclerview方法:

import androidx.recyclerview.widget.RecyclerView;

------------恢复内容结束------------

Android开发日志(3)

上一篇:android 打开文件管理到指定目录,华为VCE-L22 Android 9 ,API 28


下一篇:appium--adb版本过低