android-preferences

ListPreferences without any radio buttons?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-11 11:58:27
问题 I want to create a ListPreference in my PreferenceActivity. When a ListPreference is clicked, I get a dialog box with a listview. Each row in list view has a text field and a radio button. I do not want this radio button and also on clicking list item, I want to fire an intent that opens browser? Any idea how to go about it? If i extend DialogPreference then how to handle onClicks? Like onListClickListener will work? OR If i extend ListPreference what are the functions i need to override? 回答1

Android listpreference and widget background

ε祈祈猫儿з 提交于 2020-01-07 04:10:47
问题 I created a widget (HelloWidget.java), an activity for it (MainActivity.java) and a listpreference (EditPreferences.java). XML files: Main.xml: this has the widget Config.xml: this has the activity: buttons preferences.xml: this has the listpreference I created the preferences to let the user change the background image of the widget. I have 4 image files for this in the drawable-hdpi folder. Default background is set like android:background="@drawable/goldgreenbg" In MainActivity.java i have

How to customize divider between CheckBoxPreference in PreferenceScreen

懵懂的女人 提交于 2020-01-05 08:32:42
问题 I have PreferenceScreen contain many CheckBox and refered to theme as: <activity android:name=".Prefs" android:label="@string/app_name" android:theme="@style/PreferencesTheme"> i want to customize divider between the CheckBox , but i cant also im create custom layout for the PreferenceScreen as bellow : <?xml version="1.0" encoding="utf-8" ?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <CheckBoxPreference android:summary="checkbox one" android:key="splash"

Yes or No confirmation in Android Preferences [duplicate]

笑着哭i 提交于 2020-01-05 03:25:33
问题 This question already has answers here : How to implement a confirmation (yes/no) DialogPreference? (3 answers) Closed 5 years ago . I need to implement a "Reset" option in Settings. When the setting is clicked, a simple dialog should open asking to confirm. I've taken a look at DialogPreference but I can't seem to be able to find a good solution, or tutorials anywhere. Can someone please help me out? I'm a beginner, ideas or even code would be very helpful, thank you. 回答1: I used a simple

Yes or No confirmation in Android Preferences [duplicate]

那年仲夏 提交于 2020-01-05 03:24:09
问题 This question already has answers here : How to implement a confirmation (yes/no) DialogPreference? (3 answers) Closed 5 years ago . I need to implement a "Reset" option in Settings. When the setting is clicked, a simple dialog should open asking to confirm. I've taken a look at DialogPreference but I can't seem to be able to find a good solution, or tutorials anywhere. Can someone please help me out? I'm a beginner, ideas or even code would be very helpful, thank you. 回答1: I used a simple

Custom Preference Android Kotlin

吃可爱长大的小学妹 提交于 2020-01-04 13:58:30
问题 I'd like to subclass Preference to create a custom preference item in Kotlin. I am unable to get the custom preference to inflate in the Preference screen. If I remove this custom preference from my preference screen, the rest of the preferences I have implemented (not shown here) are working fine. There are many similar seeming questions here, but none of the ones I've found directly deal with the issue of creating a Kotlin implementation of a custom preference. Please help me with a working

PerferenceActivity with PreferenceFragment fails on device with proguard okay without proguard

杀马特。学长 韩版系。学妹 提交于 2020-01-03 17:06:06
问题 I'm coding my first app targeting ICS (4.0.3 - level 15). I get Action Bars and I think they're great. But I'm trying fragments for the first time, and I'm still not sure if I like 'em or not. The app I'm currently working on doesn't need fragments since it has pretty undynamic on screen requirements. Standard activities are working fine. The big However is that I have to use PreferenceActivity with PreferencFragment and Headers. The old form of the activity straight to the preference

setInputType on EditTextPreference

僤鯓⒐⒋嵵緔 提交于 2020-01-03 08:47:06
问题 how can i add the "setInputType" propety to an EditTextPreference (my goal is to set the input type to numbers only), i've tried: editTextPref.setInputType(InputType.TYPE_CLASS_NUMBER); but this only seems to work for EditTexts, not EditTextPreferences 回答1: You can retrieve the EditText from the Preference and from there setInputTypes or use KeyListeners to inform the keyboard: EditText et = (EditText) editTextPref.getEditText(); et.setKeyListener(DigitsKeyListener.getInstance()); 回答2: If all

Fragment item won't collapse

戏子无情 提交于 2020-01-02 07:39:01
问题 I'm trying to toggle the visibility of 1 of my shapes within a fragment but it does not work whenever I click the SwitchPreferenceCompat control & return to my loaded fragment. No errors or warnings had appeared before & during I ran the app either. Here is my code: fragment_blueshapes.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android

Separate preferences for each view in an Android app

 ̄綄美尐妖づ 提交于 2020-01-02 05:32:09
问题 I have multiple views that come and go as the application runs. I want each view to have its own personal preferences that are stored as the ID tag of the view. Above these is the "General Preferences" that the sub prefs reference to get their default values when a view it is created. Right now I have it set up that the General Preferences are the default SharedPreferences. But I have no Idea how to create the new preferences and set up an activity UI so the user can change them. Is it pretty