Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning Android Tablet Application Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Android Tablet Application Development
This is the forum to discuss the Wrox book Beginning Android Tablet Application Development by Wei-Meng Lee; ISBN: 978-1-1181-0673-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Android Tablet Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 27th, 2011, 02:35 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default PreferenceFragment: How to remove transparency?

In the PreferenceFragment Try It Out, the resulting fragment is transparent (see figure 3-22), you can still see the "Hello world" in the background fragment. If there is text on the background fragment, this can make it very difficult to read the preferences.

How can I make the preference fragment opaque? Thanks.
Reply With Quote
  #2 (permalink)  
Old November 27th, 2011, 03:26 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sovled

Ok I figured it out. I had defined the initial fragment in the XML file for the main view. You can't replace a fragment defined in this way via a fragment transaction - you can only replace fragments that you added programmatically. That's why the initial fragment remained visible in the background.

So the solution was to remove the initial fragment from main.xml layout file, and add it to the initial view using fragmentTransaction.add() instead. This way the initial fragment is successfully replaced when the preference fragment is called, and is no longer visible in the background.
Reply With Quote
  #3 (permalink)  
Old December 2nd, 2011, 05:19 PM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I ran into this exact same problem.

I'm creating an app with 2 seperate fragments, both within their own RelativeLayout. These fragments get added programmatically to these layouts during the initialization stage.
When trying to call the PreferenceFragment, it turns transparent exactly like you described.
I'm trying to replace the content in my fragments, it's still transparent. When I try to replace the entire content of the app, it's still transparent.

Now from your comment I understand you managed to fix it by removing the fragments from your main layout file, but how did your layout end up after that?

I'm pretty sure I'm on the right track but I'd like to see your final fix to push me in the right direction.
Reply With Quote
  #4 (permalink)  
Old December 3rd, 2011, 01:07 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi
We additional openness to some div container. I want to take away the transparency of the contents of which div. I want to add some text in it, but the text seems to bee transparent similar to the pot, even when it has been assigned a different div and set transparency in order to 100%
How do i do this?
thanks
Reply With Quote
  #5 (permalink)  
Old December 3rd, 2011, 06:08 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I eventually fixed it by just calling a new Intent that launches the Preference screen.
Quite a simple fix, but it works fine.

Prefs.java
Code:
public class ReaderPreferences extends PreferenceActivity {
		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			// --load the preferences from an XML file---
			addPreferencesFromResource(R.xml.preference);
		}

In my main screen when pressing a button:

Code:
Intent i = new Intent(this, Prefs.class);
			startActivity(i);

That's all. After setting the preferences simply press the back button and you're done.

Dont forget to add Prefs to your Manifest!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap Transparency tahcue C++ Programming 0 December 19th, 2007 06:45 PM
ImageList/transparency problem jacob C# 0 February 27th, 2006 07:37 AM
Transparency and repainting Volt9000 C# 0 December 18th, 2004 12:00 AM
PNG Transparency in IE richard.york Javascript 4 January 19th, 2004 07:26 PM
Transparency Problem blah VB.NET 2002/2003 Basics 0 October 30th, 2003 01:40 AM



All times are GMT -4. The time now is 05:26 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.