Skip to content Skip to sidebar Skip to footer

Listpreference Font Size

I'm using ListPreference to have the user select a location from a list. Some of the entries are cut off bcs of too long strings. I'm looking for the simplest possible way to work

Solution 1:

Extend ListPreference and override onCreateView() like this:

    @Override
protected View onCreateView(ViewGroup parent) {
    View view = super.onCreateView(parent);
    ((TextView) view.findViewById(android.R.id.title)).setSingleLine(false);
    ((TextView) view.findViewById(android.R.id.title)).setMaxLines(2);
    ((TextView) view.findViewById(android.R.id.summary)).setMaxLines(10);
    return view;
}

Post a Comment for "Listpreference Font Size"