Preference实现自定义视图

本文介绍了一个名为CustomePreference的类,它继承自Preference,并提供了自定义视图的能力。通过LayoutInflater从R.layout.account_setting布局文件中加载视图,并在onCreateView和onBindView方法中进行操作。此外,还包含了一个startFilterActivity方法,可能用于启动过滤活动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public class CustomePreference extends Preference {

   private LinearLayout mAccountContainer = null;

   private Context mContext = null;

   private Activity mActivity ;

   

   public CustomePreference (Context context, AttributeSet attrs, int defStyle) {

      super(context, attrs, defStyle);

      this.mContext = context;

   }

   public CustomePreference (Context context, AttributeSet attrs) {

      super(context, attrs);

      this.mContext = context;

   }

   @Override

   protected View onCreateView(ViewGroup parent) {

      View layout = 

         LayoutInflater.from(getContext()).inflate(R.layout.account_setting, parent,false);

      return layout;

   }

   @Override

   protected voidonBindView(View view) {

      super.onBindView(view);

   }

   public void startFilterActivity (Context context) { 

   }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值