Unable to see Activity in Android Studio - android

I'm having a problem with my Tab Activity. I can't see anything, like literally nothing. I already changed the style.xml of the activity but it still doesn't work out.
Here is my style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="Base.ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="Base.ThemeOverlay.AppCompat.Light" />
</resources>

Related

how to bring the icons closer?

I am having my app bar with three icons on it. The space between them looks quite high. How to get them closer
the following is my styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowDisablePreview">true</item>
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Use this theme changing what you think needs to be changed but definitely experiment with the width and height values to find the ones that suit your needs.
<style name="MyTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="colorControlNormal">#android:color/black</item>
<item name="android:actionButtonStyle">#style/myActionButtonStyle</item>
<item name="actionButtonStyle">#style/myActionButtonStyle</item>
</style>
<style name="myActionButtonStyle" parent="Widget.AppCompat.ActionButton">
<item name="android:width">80dp</item>
<item name="android:height">80dp</item>
</style>

Auto background color is black even when I create a new Activity

I don't know if is related with git but after committing my project using git, every Activity's background color is changed even when I create a new Activity.
Why?
My style file
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="drawerArrowStyle">#style/MyDrawerArrowToggle</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">#color/toolbar_text_color</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorControlNormal">#color/textColor</item>
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"></style>
</resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="drawerArrowStyle">#style/MyDrawerArrowToggle</item>
</style>
I changed "Theme.AppCompat.NoActionBar" to "Theme.AppCompat.Light.NoActionBar".
It is worked.Thanks everyone....
Here is the mistake you are using dark theme
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorControlNormal">#color/textColor</item>

Why Status bar is appearing with shadow?

Status bar of my app is not seem as clear or it appears with some shadow.
This is how my status bar looks:
And it should appear like this:
Why it isn't looking like this?
style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionBarOverlay">false</item>
<item name="windowActionBar">false</item>
<item name="android:windowBackground">#android:color/white</item>\
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
What's wrong with this? Please help..
Delete this line
<item name="android:statusBarColor">#android:color/transparent</item>
from your values-v21/styles.xml
If you are in android 5 or later you can set the elevation of the actionbar to 0 by below code
getSupportActionBar().setElevation(0);
If not 5 or higher then add below style in your theme
<style name="MyAppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowContentOverlay">#null</item>
</style>

How to make my app with transparrent theme?

I am making my Music player now. I want it to be lightly transparent(Android background barely visable). Structure: One activity with 4 fragments (viewPager with tabs). Any ideas?
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Just use this theme in your Activity's theme
android:theme="#android:style/Theme.Translucent.NoTitleBar"
This will make the background of your ACtivity completely transparent. You can also extend that theme and set a custom windowBackground
In your styles.xml
<style name="MyTransparentTheme" parent="#android:style/Theme.Translucent.NoTitleBar">
<item name="windowBackground">#color/my_transparent_color</item>
</style>
In case you are using AppCompat you should change the parent theme to
<style name="MyTransparentTheme" parent="#style/Theme.AppCompat.Translucent.NoTitleBar">
<item name="windowBackground">#color/my_transparent_color</item>
</style>

Can't remove shadow that's above the action bar

Note: I'm rather new to Android development, so bear with me...
I recently created a new project in Android Studio using the Navigation Drawer activity layout. Everything runs correctly, however I would like to remove the shadow that's above the action bar.
I've tried applying this solution, but it didn't seem to solve my issue.
Here are my styles.xml files:
v21/styles.xml
<resources>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
</style>
</resources>
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Any help would be greatly appreciated!
Thank you.
For some reason, this did not work for as well:
<item name="android:elevation">0dp</item>
and:
<item name="android:windowContentOverlay">#null</item>
I am currently using, for ActionBar:
this.getSupportActionBar().setElevation(0);

Categories

Resources