preference

Android: How to remove margin/padding in Preference Screen

一笑奈何 提交于 2019-11-26 18:45:37
I am facing very weird problem in designing preference screen. Though I am not giving any margin in layout,it is leaving some space in left. As you can see in image below: XML: <PreferenceScreen android:title="demo" > <CheckBoxPreference android:defaultValue="false" android:key="prefSync"` android:title="Auto Sync" /> </PreferenceScreen> Am I doing something wrong in adding check-box preference in screen? Updating this for androidx. After a lot of experimentation, I resolved this issue by adding this to each preference that had the excess indentation: app:iconSpaceReserved="false" Of course,

creating a DialogPreference from XML

吃可爱长大的小学妹 提交于 2019-11-26 10:35:24
问题 I have been attempting to use an android.preference.DialogPreference inflated from XML, but the documentation seems to be missing some essential bits, and I cannot find a working example anywhere. My XML now looks like this (I tried many permutations but this seems like a reasonable minimum): <DialogPreference android:key=\"funThing\" android:title=\"Fun Thing\" android:dialogLayout=\"@layout/fun_layout\" android:positiveButtonText=\"OK\" android:negativeButtonText=\"Cancel\" /> My

Android: How to maximize PreferenceFragment width (or get rid of margin)?

痞子三分冷 提交于 2019-11-26 08:26:07
问题 If you look at either Android Settings screenshot or FragmentsBC screenshot, there are margin in PreferenceFragment. How can you get rid of it? I tried making PreferenceFragment width to fill_parent, but no luck. 回答1: Finally, I found the solution to this. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = super.onCreateView(inflater, container, savedInstanceState); if(v != null) { ListView lv = (ListView) v.findViewById

Android: How to remove margin/padding in Preference Screen

核能气质少年 提交于 2019-11-26 06:32:15
问题 I am facing very weird problem in designing preference screen. Though I am not giving any margin in layout,it is leaving some space in left. As you can see in image below: XML: <PreferenceScreen android:title=\"demo\" > <CheckBoxPreference android:defaultValue=\"false\" android:key=\"prefSync\"` android:title=\"Auto Sync\" /> </PreferenceScreen> Am I doing something wrong in adding check-box preference in screen? 回答1: Updating this for androidx. After a lot of experimentation, I resolved this