Android PreferenceScreen和PreferenceWidget实例访问
在我的应用程序中存在我自己的类Android PreferenceScreen和PreferenceWidget实例访问,android,widget,instance,preferenceactivity,preferencescreen,Android,Widget,Instance,Preferenceactivity,Preferencescreen,在我的应用程序中存在我自己的类 public class ColorAccesoryView extends View{ @Override protected void onDraw(Canvas cv){ } } 用于布局color\u accesory.xml <?xml version="1.0" encoding="utf-8"?> <android.swp.ColorAccesoryView xmlns:android="http://schema
public class ColorAccesoryView extends View{
@Override protected void onDraw(Canvas cv){
}
}
用于布局color\u accesory.xml
<?xml version="1.0" encoding="utf-8"?>
<android.swp.ColorAccesoryView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/color_box"
android:layout_width="52dp"
android:layout_height="26dp"
android:gravity="right"
android:paddingRight="12dp" />
如何访问ColorAccesoryView的两个实例以分别为每个首选项设置它?尝试在组视图元素中包装布局颜色\u accesory.xml:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.swp.ColorAccesoryView
android:id="@+id/color_box"
android:layout_width="52dp"
android:layout_height="26dp"
android:gravity="right"
android:paddingRight="12dp" />
</FrameLayout>
尝试在组视图元素中包装布局颜色\u accesory.xml:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.swp.ColorAccesoryView
android:id="@+id/color_box"
android:layout_width="52dp"
android:layout_height="26dp"
android:gravity="right"
android:paddingRight="12dp" />
</FrameLayout>
OK但问题是:如何访问ColorAccesoryView的两个实例以分别设置每个首选项?OK但问题是:如何访问ColorAccesoryView的两个实例以分别设置每个首选项?