Separator between PreferenceCategory

I know how to change the color of Headers inside PreferenceCategory

.

public class PreferenceCategory1 extends PreferenceCategory {
    public PreferenceCategory1(Context context) {
        super(context);
    }

    public PreferenceCategory1(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public PreferenceCategory1(Context context, AttributeSet attrs,
            int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected void onBindView(View view) {
        super.onBindView(view);
        TextView titleView = (TextView) view.findViewById(android.R.id.title);
        titleView.setTextColor(Color.rgb(238, 120, 30));

    }
}

      

But I also want to change the separator between PreferenceCategory

and items below. I tried to grab the list and use the setDivider () method:

  ListView v = (ListView)view.findViewById(android.R.id.list);
  v.setDivider(new ColorDrawable(Color.rgb(238, 120, 30)));

      

But this throws a NullPointerException due to what it cannot find list

in this view

. I know I can set this in an XML file and add this as a style, but I want to do it in java if possible. Any suggestions?

+3
android listview


source to share


No one has answered this question yet

Check out similar questions:

5641
What is the difference between "px", "dip", "dp" and "sp"?
1270
How to pass data between activities in an Android app?
1177
What is the difference between match_parent and fill_parent?
1152
Difference between gravity and layout_gravity on Android
868
How to add separators and spaces between items in RecyclerView?
685
Android separator / line separator in layout?
nine
Android: EditText causing memory leak
7
ScrollView: two EditTexts focus issues
0
Displaying extended views on Android
0
Undo / Redo not working in android Canvas



All Articles
Loading...
X
Show
Funny
Dev
Pics