Android PreferenceScreen and Preference widget instance access -
in app exist own class
public class coloraccesoryview extends view{ @override protected void ondraw(canvas cv){ } }
used in layout color_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" />
while preferencescreen create, set xml widget in 2 different preferences
color1_pref.setwidgetlayoutresource(r.layout.color_accesory); ... color2_pref.setwidgetlayoutresource(r.layout.color_accesory);
how access 2 instances of coloraccesoryview setup each preference separatelly?
try wrap layout color_accesory.xml in group view element:
<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>
Comments
Post a Comment