getLayoutParams()方法:
返回控件的LayoutParams 对象,LayoutParams继承于Android.View.ViewGroup.LayoutParams.。LayoutParams相当于一个Layout的信息包,它封装了Layout的位置、高、宽等信息
setOnTouchListener:
可以分别设置按住事件发生后的代码;移动事件发生后的代码;松开事件发生后的代码
android:ems = "10" 的含义
指的是将对应的控件宽度设为10个字符的宽度。当设置该属性后,一行中最大只能显示设置的宽度。
根据字符串获取mipmap的Id值(此方法用于资源文件较多时利用文件名去找寻对应的资源)
int resId = context.getResources().getIdentifier("filename", "mipmap", context.getPackageName());
imagView.setBackground(context.getResources().getDrawable(resId,null));