修改交友布局
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.xscm.moduleutil.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
|
||||
@SuppressLint("AppCompatCustomView")
|
||||
public class RoleView extends ImageView {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public RoleView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
|
||||
public RoleView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public RoleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
this.mContext = context;
|
||||
// setVisibility(GONE);
|
||||
// setImageResource(R.mipmap.img_host);
|
||||
}
|
||||
|
||||
|
||||
public void setRole(int role) {
|
||||
this.setVisibility(VISIBLE);
|
||||
if (role == 1) {
|
||||
setImageResource(R.mipmap.img_host);
|
||||
} else if (role == 2) {
|
||||
setImageResource(R.mipmap.img_admin);
|
||||
} else if (role == 5) {
|
||||
setImageResource(R.mipmap.img_official);
|
||||
} else {
|
||||
this.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user