Transparent Navigation Bar for Lollipop app? - android

What do I add to themes.xml to change the navigation bar to be more transparent? I can't find documentation for it anywhere. Thanks!

In your theme add the following line:
<item name="android:windowTranslucentNavigation">true</item>
Romain Guy has published a nice sample app that uses this API. Maybe it will help. (You might need to refactor some code since the project was originally written using the Android L developer preview).

Alex's answer is correct. You can use
<item name="android:windowTranslucentNavigation">true</item>
Another option is to use
<item name="android:windowBackground">#android:color/transparent</item>

Related

How to achieve windowSplashScreenBrandingImage in Android below 12 after migrating to new SplashScreen api

I've followed Migrate your splash screen implementation, and it promises that After you migrate using the SplashScreen compat library, the system displays the same splash screen on all versions of Android.
I've created the new splash theme, but the issue is that, I don't have an option to put windowSplashScreenBrandingImage for style belowe values-v31, that is, for android lower than 12.
So the bottom bar that we have been using previously can'be shown as of now.
values-v31/style
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.SplashThemeNew" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#android:color/white</item>
<item name="windowSplashScreenAnimatedIcon">#drawable/splash_icon</item>
<item name="android:windowSplashScreenBrandingImage">
#drawable/background_splash_12_bottom_strp
</item>
<item name="postSplashScreenTheme">#style/AppTheme</item>
</style>
</resources>
style
<style name="Theme.App.SplashThemeNew" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#color/white</item>
<item name="windowSplashScreenAnimatedIcon">#drawable/splash_icon</item>
<item name="postSplashScreenTheme">#style/AppTheme</item>
</style>
While according to the Migration guide, it should be possible, Has anyone some ideas about this?
Thanks for your time and attention.
Unfortunately it is not possible to use the android:windowSplashScreenBrandingImage on api lower than 31. This issue has officially been reported as a feature request on the IssueTracker, but for now they say that it won't be implemented (Source). However, it is still assigned so it might get implemented in the future.
Besides that, the Android docs state that The design guidelines recommend against using a branding image.
That being said, I found an Medium article that might help you achieve what you are looking for.

Editing the underbar on a tab in Android

Hey guys I am newer to Android development and I am trying to to figure out how to edit the underbar that is on the tabs when one is selected. I have this:
<item name="android:actionBarTabBarStyle">#style/Theme.test.tabbar.style</item>
Which points here:
<style name="Theme.test.tabbar.style" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/black</item>
<item name="android:actionBarItemBackground">#color/yellow</item>
</style>
This works great except the android:actionBarItemBackground So I was wondering what do I need to point to in order to edit the active bar that shows underneath a tab you are active on?
David
Create a custom theme using this online services and then aplly the theme (remember to copy all the resources in your project!)
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html

ActionBarSherlock with Action Bar Style Generator

for the last few days I'm trying to implement custom theme, which is created by Action Bar Style Generator to my application. I'm able to use theme with some generic samples from SDK, but I'm not able to use it with my application which uses ActionBarSherlock.
My application with ActionBarSherlock is a modified sample of Tabs and Pager.
Steps which I do:
Create theme with Android Action Bar Style Generator.
Copy theme to res folder inside my application.
Change theme in Manifest file.
After those steps only 'Action bar color' changes to correct one. All other styles are not used in application. I have tried many different approaches which I found online, but without success.
Thank you very much for your help.
Did you add the proper items to your App's theme in styles.xml? You need to use attributes that are NOT prefixed with android:, for example:
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="background">#drawable/bg_striped</item>
<item name="backgroundSplit">#drawable/bg_striped_split</item>
You would also keep the properly prefixed ones for Android versions that have native actionbar.
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="android:background">#drawable/bg_striped</item>
<item name="android:backgroundSplit">#drawable/bg_striped_split</item>
The best place to understand this is to look at the demo provided with the ActionBarSherlock library project.
I managed to fix the problem.
I missed android:background attribute in TabWidget. This partially
solves the problem.
I had to set setLeftStripDrawable and setRightStripDrawable programatically.

Styling the ActionBar

Re this example from the Android developer blog
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
It says that to style the tabs on the action bar, to use a style like this:
<style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBarView_TabView">
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
</style>
It references a parent style of "android:style/Widget.Holo.Light.ActionBarView_TabView" - which my project is unable to locate. I'm building against v3.2, with a min sdk of platform 8 (v2.2). I'm using ActionBarSherlock.
Am I doing something wrong, or is the sample code incorrect? What style can I inherit from?
Am I doing something wrong, or is the sample code incorrect?
The sample code was correct at the time and no longer is correct.
#Macarse has a blog post with the fix. Quoting Xav's comment on the related issue:
What is happening is that some styles, like WindowTitle are not public (you won't find them in android.R.style). You should not be extending non public resources. aapt used to let you do that but it was a bug which was fixed in platform-tools r6.

Android 3.0 ActionBar, changing colors

How can I change the color of the underline beneath the tabs? It's currently the light blue, and I can't find any resources on how to change this for Android 3.0.
Additionally, I'd like to change the text color for the menu items that show up on the right of the ActionBar as a result of: android:showAsAction="ifRoom|withText"
Anyone know how to change these?
You can control the appearance of the tabs by using the properties android:actionBarTabStyle, android:actionBarTabBarStyle, and android:actionBarTabTextStyle.
This section in the official developer guide shows a sample xml to customize the action bar's style.
Regarding the text of the menu options check the properties actionMenuTextAppearance and actionMenuTextColor.
As additional info, here's how I found out how to change the blue bar below each tab (the answer above is perfectly good, but I lacked little information that I put here, which might be useful to somebody).
You just need to change the background to a 9 patch drawable.
Here's how it looks like:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Source available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable/actionbar_tab_bg.xml
9 patches available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable-mdpi
I know this was really easy, but again, it might be useful so I'm just dropping the links here.
None of these solutions worked for me. I changed the colors of my tabs as follows:
This is in the themes.xml
<style name="MyApp" parent="android:style/Theme.Holo">
<item name="android:actionBarTabTextStyle">#style/MyApp.ActionBar.MyTabStyle</item>
</style>
This is in styles.xml
<style name="MyApp.ActionBar.MyTabStyle" parent="android:style/Widget.Holo.ActionBarView_TabText">
<item name="android:textColor">#00ff00</item>
</style>
This should make your tabs green.
I think that you can use:
<resources>
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionMenuTextColor">#color/...</item>
</style>
</resources>
Regards

Categories

Resources