I'm designing a custom Android 4.0 (ICS) device for special purpose.
One of the things I'm looking for is a way to make the Android Launcher, when other activities were previously running, show the last running activity as a transparent, dimmed background, with the launcher icons and widgets on top.
What I'm looking for, is something like this: How do I create a transparent Activity on Android?, except as a modification to Launcher2. I guess I can apply a similar style to the launcher as proposed in that SO, but what about the wallpaper?
AFAIU, the wallpaper is rendered by a separate service, and I still want it rendered if there are no other activities behind the launcher.
Any tips?
I figured this one out myself eventually. It turned out pretty simple.
Just modify the theme as suggested in the mentioned SO-article, and simply change inheritance from the Wallpaper-enabled theme.
Also, there were a small code-snippet that was reactivating the wallpaper. Switch that out, and I've now got a transparent launcher, that shows what's going on behind it.
Related
When opening my app for the first time, i can see a white screen for two or three seconds. After that, the first activity is shown.
¿How to avoid this annoying white screen? I'm pretty sure it's caused by the theme Theme.AppCompat.Light.DarkActionBar which I'm using.
I'm using this new theme because I'm using a NavigationView with a PagerTitleStrip and in the documentation of google they where using this theme to develop this kind of views.
How can i avoid that annoying white screen? If that screen can be for example black, it is munch better and munch less annoying. Can its color be changed? Has this theme a black version but without losing compatibility with a NavigationView with a PagerTitleStrip?
Thank you.
On your xml that you are using for your splashscreen add
android:opacity="opaque"
As cricket_007 tell in the comments, it is possible to get black color theme instead of Light simply using "Theme.AppCompat"
Also as CommonsWare tell us, too in the comments, it is a good practice to search if you are doing too much work in the main thread and use threads to get a fast ui load.
Thank you guys
At the moment, I'm stuck with a very annoying kind of "bug" I assume regarding all Pre-Lollipop Android versions. It appears that (support) fragments don't apply the activity's theme they're assigned to. To make my explanations a bit easier, have the following demonstration:
My app runs with a turquoise theme at first. Let's say, the user decided to change the turquoise theme to a red theme. He or she restarts the app and is greeted with the following:
(screenshot taken on an Android 4.4.2 tablet)
Terrible sight, isn't it? However, if I run the same app in an emulator with Android L the whole theme problem doesn't even seem to exist.
There's especially one thing which seems odd about the tablet screenshot. The fragment itself doesn't apply the theme but child components inside the fragment which get added lateron (like the view with the exclamation mark which is hosted by a ViewPager) take and apply the theme as if nothing happened.
I'm not quite sure what the issue might be. I've done everything as stated in every document available. I set the theme before I call setContentView(resource) in the corresponding activity. I tried to do the trick with ContextThemeWrapper but it was no use.
Relevant code:
The activity's onCreate()
The fragment's onCreateView()
The fragment's layout
Attributes
Themes (a lot of them)
I tried to resolve this issue for days now and I still can't find out why this is not working. I haven't found a suitable answer yet and would love some advise.
I've been the victim to my own stupidity. I had another close look on my project setup and found this:
My tablet takes its layout resources from the sw600dp-folder, but I forgot to change the corresponding layout to take attributes instead of hardcoded colors. I think I have to retire after making such a stupid mistake.
The last few days I've been doing great stuff in development, but I've seem to have hit a wall on something probably stupid simple. It's annoying. I was hoping I could get some help.
What I'm trying to do
I'm trying to create the awesome transparent ActionBar animation effect from Google Music (as described by Cyril Mottier here)
The problem
I can't even get the actionbar to go into overlay / transparent mode.
My set-up
I've got a library-oriented set-up in Eclipse. I've got a library project (let's call it master) that contains all the actual code and activities. Then I've got a project, that just plugs into the master library (let's call it slave). Lastly there's some open source support libraries that master uses (among others is ActionBarSherlock).
The activity I'm trying to apply this effect to is in the master library. It is declared in slave's manifest as com.example.master.DetailActivity, and that works like a charm.
Also: The theme for the activity may come from several places. Either it's set by slave's manifest, or by master at runtime. Themes may come from the master OR the slave project.
What I've tried
Feels like everything. I've started out by creating a custom theme based on Cyril's article. I made sure that for every item I've had a version with and without the android: prefix as per Jake Wharton's instructions.
I've also tried setting it at runtime using requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
What I've got
Nothing. The theme applied succesfully (I can see the actionbar's colors change appropriately), but it NEVER goes into overlay mode, nor does it become transparent.
Help would be greatly appreciated, and would probably be helpful to other's trying this effect.
EDIT:
Here are my themes and styles. Codes are kinda messy because I've been experimenting with them to see where I was going wrong. AppTheme and Theme.TranslucentActionBar.ActionBar.Overlay both won't work.
/res/values/
styles.xml
themes.xml
/res/values-v11/
styles.xml
themes.xml
I'm testing on a Nexus 4 with 4.2.2 installed as well as a 2.3.3 emulator.
OK, so apparently, with my set-up, you can't do it using themes.
I ended it up doing it, globally like this.
setTheme(theme.whatever);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.content);
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.color)); // This is #212121 solid color for the dark action bar.
The lines are spread out over my code, but this is the gist of it. The order is important.
I also found out that sliding menu seemed to be blocking the overlay mode. I had to remove the instance for it to work. I'm still looking for a way to enable both overlay mode and the sliding menu.
So I am still working on my messaging app, and I have successfully implemented a few popups on my own, but then they don't turn out exactly as I want...
The theme is supposed to be strictly black text on white background, zero transparency (Theme.Light.NoTitleBar). While I have no problems whatsoever in the activity itself, my trouble is with the popups, whose theme does not seem to match as I expected. Can anybody tell me how to fix these?
It looks like after much trial and error, I only had to force the views to use specific styles/themes.
For the popup menu (PopupWindow):
menu.setBackgroundDrawable(getResources().getDrawable(
android.R.color.background_light));
For the dialog (DialogFragment), it's...:
setStyle(android.R.style.Widget_ListView, android.R.style.Theme_NoTitleBar);
...Or it just corrected itself.
I am trying to put a dynamic value in the launcher icon of android, as number of messages will be displayed in the message icon. As the icon is static and initialised before the application starts, Is there any way to achieve this??
For Android Launcher Icon you can't. It is impossible. (Or by Making your own launcher) The only one thing is you have to make a Android-Widget for this purpose. Which looks like a application icon. But it will act as a widget.
Also Make a dynamic launcher icon
simple answer is you can't do it also this question says the same. But there may be advance tricky methods/ways that I'm not aware of.
But you may try and develop widgets that changes dynamically.
You have to design your icon as a selector instead of drawable. Have a look at this.
You cant update because its related to manifest.xml stuff only possible with software upgrade.