I used the answer of this question: Android CheckBoxPreference title color But when i deployed to my application, i click to "account setting" section => Settings stoped .What is wrong here?
Asked
Active
Viewed 30 times
0
-
If you give an example of your code and what happens, I suspect that you might get a helpful answer. As it is, one would need to look at the linked question. But I would guess that what you are doing might be a bit different. – JoelParke May 16 '15 at 04:22
-
I have posted it below. Thank Joel!! – Anubis21DEC May 16 '15 at 06:09
1 Answers
0
This is my Custom CheckBoxPreference
package vn.com.myapp.view;
import android.content.Context;
import android.graphics.Color;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
/**
* Created by anubis on 5/16/15.
*/
public class MyCheckBoxPreferences extends CheckBoxPreference {
public MyCheckBoxPreferences(Context context) {
super(context);
}
public MyCheckBoxPreferences(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyCheckBoxPreferences(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onBindView(View view) {
super.onBindView(view);
TextView title = (TextView) view.findViewById(android.R.id.title);
title.setTextColor(Color.BLACK);
}
}
And using it
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Options" />
<vn.com.myapp.view.MyCheckBoxPreferences
android:checked="true"
android:clickable="false"
android:defaultValue="true"
android:focusable="false"
android:key="contactSync"
android:summary="Sum1"
android:textColorHighlight="@color/textColorSecondary"
android:title="tit1" />
<vn.com.myapp.view.MyCheckBoxPreferences
android:editable="false"
android:checked="true"
android:clickable="false"
android:defaultValue="true"
android:focusable="false"
android:key="smsSync"
android:summary="Sum2"
android:textColorHighlight="@color/textColorSecondary"
android:title="tit2" />
<vn.com.myapp.view.MyCheckBoxPreferences
android:checked="true"
android:clickable="false"
android:defaultValue="true"
android:focusable="false"
android:key="callLogSync"
android:summary="Sum3"
android:textColorHighlight="@color/textColorSecondary"
android:title="tit3" />
</PreferenceScreen>

Anubis21DEC
- 41
- 5