android - PreferenceFragment with transparent background? -
I created a PreferenceRegment with two categories and a checkbox, however, when I display it in my app The background appears to be transparent.
I can see main activities, fields and people with priority have been placed above main activity ... what is the solution?
In my main activity, I am doing this to open the Preferences Notification when the Settings button is selected:
@Override Public Boolean Operations Item Selected (Menu Item Item) {// Handle press action item on item switch (item.getItemId ()) {case RID.action_settings: getFragmentManager (). BeginTransaction (). (Android.RID content, new settingsfragment ()). Committed (); Back true; Default: Return Super.Options item selected (item); }}
My choice fragment code looks like this: Public class setting enhances the spreading priority {
@Orride Creates a public void (bundle saved) InstantState) {super.onCreate (savedInstanceState); // Load preferences from an XML resource addPreferencesFromResource (R.xml.preferences); }}
My preferences.xml looks like this:
Preferences screen xmlns: android = "http://schemas.android.com/apk / Res / android "android: layout_height =" wrap_content "Android: layout_width =" wrap_content "Android: layout =" @ layout / section-settings "& gt; & Lt; PreferenceCategory Android: Title = "@ string / server_prefs_title" Android: key = "pref_key_server_settings" & gt; & Lt; Checkbox preference Android: key = "pref_server_url" android: title = "@ string / pref_server_url" Android: Summary = "@ string / pref_server_url_summ" Android: defaultValue = "true" /> & Lt; / PreferenceCategory & gt; & Lt; PreferenceCategory Android: Title = "@ string / company_prefs_title" Android: key = "pref_key_company_settings" & gt; & Lt; / PreferenceCategory & gt; & Lt; / PreferenceScreen & gt;
I suggested another answer on the stack overflow and added it to my priority section, however, although it blocks the areas visible from main activity, it appears to be just a mask Is because the pieces that are set by the colors I'm also affecting are:
@ Override public view creatives (LayoutEfter Inflator, View Group Container, Bundle Co J. The Instensstet) {views = Suprkkontet scene (Infletr, container, saved Instensstet); View.setBackgroundColor (.getResources () getColor (android.R.color.black)); Return view; }
Thanks for the help!
EDIT: I think I answered my question while typing ... I said:
<> addPreferencesFromResource (R.xml.preferences) pre; After
:
View View = Super. Contents (Inflator, Container, Saved Instantstate); View.setBackgroundColor (.getResources () getColor (android.R.color.black));
Is there a proper way to do this?
Add it to your piece (settingsfragment), which increases the preferences:
@ Override Public View Creatives (LayoutEfter Inflator, View Group Container, Bundle Saved InstantState) {View View = SuperConnectview (Inflator, Container, Saved InstantState); View.setBackgroundColor (.getResources () getColor (android.R.color.white)); Return view; }
Comments
Post a Comment