Commit fd25d4fc authored by zhengyingbing's avatar zhengyingbing
Browse files

feat(app):删除无用的类

parent 6b89a024
package com.hl.account;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.hoolai.demo.R;
public class MineItemView extends LinearLayout {
//构造方法
public MineItemView(Context context) {
super(context);
}
public MineItemView(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context, attrs);
}
public MineItemView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context, attrs);
}
//初始化View
private void initView(Context context, AttributeSet attrs) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.hl_account_main_textview, this, true);
ImageView leftImg = view.findViewById(R.id.mine_item_img);
ImageView rightImgView = view.findViewById(R.id.mine_item_next);
TextView titleView = view.findViewById(R.id.mine_item_title);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MineItemView);
String title = typedArray.getString(R.styleable.MineItemView_title);
Drawable leftDrawable = typedArray.getDrawable(R.styleable.MineItemView_leftImg);
Drawable rightDrawable = typedArray.getDrawable(R.styleable.MineItemView_rightImg);
typedArray.recycle();
if (leftDrawable == null) {
leftDrawable = ContextCompat.getDrawable(context, R.mipmap.ic_launcher);
}
leftImg.setBackground(leftDrawable);
if (rightDrawable == null) {
rightDrawable = ContextCompat.getDrawable(context, R.mipmap.ic_launcher);
}
rightImgView.setBackground(rightDrawable);
titleView.setText(title);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment