Android开发自定义组合控件
来源:互联网 发布:淘宝租房在哪个地方 编辑:程序博客网 时间:2024/06/03 13:32
public class MyRegItemView extends RelativeLayout{ private TextView leftTextView; private TextView rightTextView; private ImageView rightImageView; public MyRegItemView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); LayoutInflater.from(context).inflate(R.layout.item_reg_baseinfo, this, true); leftTextView = (TextView)findViewById(R.id.tv_left_msg); rightTextView = (TextView)findViewById(R.id.tv_right_msg); rightImageView = (ImageView)findViewById(R.id.iv_right); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.MyRegItemView); if(attributes != null){ String leftMsg = attributes.getString(R.styleable.MyRegItemView_leftMsg); String rightMsg = attributes.getString(R.styleable.MyRegItemView_rightMsg); int rightImageSrc = attributes.getResourceId(R.styleable.MyRegItemView_rightImageSrc,R.mipmap.ic_right); rightImageView.setImageResource(rightImageSrc); if(!TextUtils.isEmpty(leftMsg)){ leftTextView.setText(leftMsg); } if(!TextUtils.isEmpty(rightMsg)){ rightTextView.setText(rightMsg); } attributes.recycle(); } } public void setRightResult(String result){ if(!TextUtils.isEmpty(result)){ rightTextView.setText(result); } }}
阅读全文
0 0
- Android开发自定义组合控件
- 学习Android开发-自定义组合控件
- android开发笔记之自定义组合控件
- Android自定义组合控件
- android自定义组合控件
- Android自定义组合控件
- android组合自定义控件
- android 自定义组合控件
- android 自定义组合控件
- android 自定义组合控件
- Android自定义组合控件
- android自定义组合控件
- Android 自定义组合控件
- android自定义组合控件
- android 自定义组合控件
- android 自定义组合控件
- android 自定义组合控件
- Android自定义组合控件
- OpenCV004:空白图片生成与基本图形绘制
- 9.笔记 MySQL学习——处理日期
- python3-GBK编码字符串截取指定位置字串
- Java多线程学习(吐血超详细总结)
- 购票系统模式
- Android开发自定义组合控件
- vs2013用qt编写串口通信程序
- 10.笔记 MySQL学习——模式匹配
- ssm三大框架基本配置
- 蓝桥杯 入门训练 Fibonacci数列
- HDU 2546 饭卡(01背包)
- 圆的面积
- copy
- 11.笔记 MySQL学习——设置和使用自定义变量