package com.example.angluswang.mobilesafe.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;

import com.example.angluswang.mobilesafe.R;

/**
 * Created by Jeson on 2016/6/6.
 * 设置中心的自定义控件
 */

public class SettingItemView extends RelativeLayout {

    public SettingItemView(Context context) {
        super(context);
        initView();
    }

    public SettingItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    public SettingItemView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }

    /**
     * 初始化布局
     */
    private void initView() {
        //将自定义好的布局文件设置给SettingItemView
        View.inflate(getContext(), R.layout.view_setting_item, this);
    }
}

@@ -156,30 +156,94 @@
 .widget.
-RelativeLayout
+CheckBox;%0Aimport android.widget.RelativeLayout;%0Aimport android.widget.TextView
 ;%0A%0Aimpor
@@ -338,16 +338,16 @@
 %E6%8E%A7%E4%BB%B6%0A */%0A%0A
-
 public c
@@ -393,16 +393,107 @@
 yout %7B%0A%0A
+    private TextView tvTitle;%0A    private TextView tvDesc;%0A    private CheckBox cdStatus;%0A%0A
     publ
@@ -1025,20 +1025,194 @@
 tem, this);%0A
+        tvTitle = (TextView) findViewById(R.id.tv_title);%0A        tvDesc = (TextView) findViewById(R.id.tv_desc);%0A        cdStatus = (CheckBox) findViewById(R.id.cb_status);%0A
     %7D%0A%7D%0A

设置中心页面 及 自定义SettingItemView