styleable表示属性
public ListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs,
com.android.internal.R.styleable.ListView, defStyle, 0); //styleable表示属性
CharSequence[] entries = a.getTextArray(
com.android.internal.R.styleable.ListView_entries); //引用其中的属性
...}
//styleable映射在attrs.xml或者style里面
主要是看xml中对应的标签
attrs.xml
<declare-styleable name="ListView">
<!-- Reference to an array resource that will populate the ListView. For static content,
this is simpler than populating the ListView programmatically. -->
<attr name="entries" />
<!-- Drawable or color to draw between list items. -->
<attr name="divider" format="reference|color" />
<!-- Height of the divider. Will use the intrinsic height of the divider if this
is not specified. -->
<attr name="dividerHeight" format="dimension" />
attr/style表示主题
protected AlertDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, com.android.internal.R.style.Theme_Dialog_Alert);
}
public CheckBox(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.checkboxStyle);
}
(都在themes.xml中)
Theme_Dialog_Alert: 对应主题Theme.Dialog.Alert <style name="Theme.Dialog.Alert">
checkboxStyle : 默认主题Theme中 <item name="checkboxStyle">
总结:主要还是看xml中的标签