You need to override it for multiple line support.
public class MultilineCheckBoxPreference extends CheckBoxPreference{
public MultilineCheckBoxPreference( Context context, AttributeSet attrs)
{
super(context, attrs);
}
protected void onBindView( View view)
{
super.onBindView(view);
makeMultiline(view);
}
protected void makeMultiline( View view)
{
if ( view instanceof ViewGroup)
{
ViewGroup grp=(ViewGroup)view;
for ( int index = 0; index < grp.getChildCount(); index++)
{
makeMultiline(grp.getChildAt(index));
}
} else if (view instanceof TextView)
{
TextView t = (TextView)view;
t.setSingleLine(false);
t.setEllipsize(null);
}
}
}
For example:
<com.futuredial.diagnostic.ui.hwdiag.SettingCheckBoxPreference
android:persistent="true"
android:defaultValue="true"
android:key="auto_turn_off_wifi"
android:title="@string/wifi_autooff" />
No comments:
Post a Comment