I used the appcompat to implemented the actionbar, now I want to change the clear icon. And I have done this:
<item android:id="#+id/action_search_note"
android:title="#string/search_title"
android:orderInCategory="101"
android:icon="#drawable/ic_action_search"
snailnote:showAsAction="collapseActionView|ifRoom"
snailnote:actionViewClass="android.support.v7.widget.SearchView" />
my team:
<item name="searchViewCloseIcon">#drawable/search_clear_normal</item>
I also tried to add
<item name="android:searchViewCloseIcon">#drawable/search_clear_normal</item>
but it is giving an error, and I final removed it.
But it dosen't work, how should I change the clear icon in a right way.
<style name="AppTheme" parent="#style/Theme.Base.AppCompat.Light.DarkActionBar">
<item name="actionBarWidgetTheme">#style/YourActionBarWidget</item>
</style>
<style name="YourActionBarWidget" parent="#style/Theme.AppCompat">
<item name="searchViewCloseIcon">#drawable/xxx</item>
</style>
<style name="SearchViewStyle" parent="Widget.AppCompat.SearchView">
<item name="closeIcon">#drawable/search_clear_normal </item>
</style>
Related
Following is what I have guessed so far to manipulate the colors. I couldn't find the name tag for the day-shortcuts marked in the pic below.
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#2e0074</item> <!-- FF4081 -->
<item name="android:background">#292929</item> <!-- Bg-->
<item name="android:textColor">#ffffff</item> <!-- Header & Ok / Abbrechen -->
<item name="android:textColorPrimary">#ffffff</item> <!-- Date numbers -->
</style>
Change Color of Day-Shortcuts in Xamarin DatePicker
To change the color of the weekday in the DatePickerDialog, try adding the android:textColorSecondary item to the <style> tag.
Check the code:
styles.xml
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
...
<item name="android:textColorSecondary">#color/colorAccent</item>
</style>
Activity class
DateTime currently = DateTime.Now;
DatePickerDialog dialog = new DatePickerDialog(
this,
Resource.Style.AppCompatDialogStyle,
this,
currently.Year,
currently.Month - 1,
currently.Day);
dialog.Show();
The screenshot:
I want to make the following image to be the background for the entire Xamarin.Android application:
I reference the image in Base application theme in styles.xml :
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
.....
<item name="android:windowBackground">#drawable/ic_app_background_image</item>
.....
</style>
The background applies to all the application but the image has dark background:
Also the number 51 has some strange things around it.
When I set the android:background="#drawable/ic_app_background_image" to the most outer LinearLayout of an activity it works fine, it shows the screen like that:
How can I fix the android:windowBackground property setting the background to black issue so I don't have to put android:background="#drawable/ic_app_background_image" in the LinearLayout of every activity?
You can try following method:
1.Create new file name as bg.xml in drawable folder (bg.xml)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="#color/splash_background"/>
</item>
<item>
<bitmap
android:src="#drawable/splash_logo"
android:tileMode="disabled"
android:gravity="center"/>
</item>
</layer-list>
2.define background color in colors.xml
<color name="window_background">#F5F5F5</color>
<color name="splash_background">#FFFFFF</color>
3.define new style MyTheme.Splash in style.xml and use the bg in item android:windowBackground
<style name="MyTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#drawable/bg</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowActionBar">true</item>
</style>
4.Usage in Activity
[Activity(Theme = "#style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : AppCompatActivity
{
// other code
}
Update:
If you want to apply this style to all activities, you can just add the following code to your Base application theme. And we don't need to set for each activity. For example:
<!-- Base application theme. parent="Theme.AppCompat.Light.DarkActionBar" -->
<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="android:windowBackground">#drawable/bg</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowActionBar">true</item>
</style>
The result is:
For more details, you can check: https://learn.microsoft.com/en-us/xamarin/android/user-interface/splash-screen
enter image description hereHow to change the status bar icon color for splash screen (LaunchScreenTheme) in android ?
I tried the below code but it's not working .
<color name="ns_ThemeBase">#FFFFFF</color>
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase">
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="colorPrimaryDark">#color/ns_ThemeBase</item>
</style>
How to change the status bar background to white and the icons to black ?
If it helps, I wasn't able to make status bar transparent, my workaround is to hide it.
Try to add those two lines in your style :
<item name="android:windowFullscreen">true</item>
<item name="windowActionBar">false</item>
You should have this (styles.xml) :
<!-- Launch Screen -->
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase">
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="colorPrimaryDark">#color/ns_ThemeBase</item>
<item name="android:windowFullscreen">true</item>
<item name="windowActionBar">false</item>
</style>
Working example : https://github.com/mickaeleuranie/nativescript-stackoverflow-49236235
How it looks :
enter image description here
This is what i actually looked for and i achieved it by using the code
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase">
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowLightStatusBar">true</item>
<item name="colorPrimaryDark">#color/ns_ThemeBase</item>
</style>
Thanks for all your support , Cheers :)
I have 4 different activities on my app, in 2 of them it shows a white Title bar (with activity or package name) above my custom toolbar, but in other 2 this bar is hidden by the custom one.
I want to show only my custom toolbar and hide the default...
this is my "styles.xml" code:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:colorPrimary">#color/primaryColor</item>
<item name="android:colorPrimaryDark">#color/primaryDarkColor</item>
<item name="android:colorAccent">#color/secondaryColor</item>
<item name ="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
</style>
<style name="MyActionBar" parent="#android:style/Theme.Holo.NoActionBar">
<item name="android:background">#color/primaryColor</item>
<item name="android:textColor">#color/primaryTextColor</item>
</style>
</resources>
[Solved]
I just change the class my Activities was inheriting from AppCompatActivity to FragmentActivity (until now I have no issues came from this change)
In my application default back button color is white. I need to change that back button color to black. I am tried so many post's for changing back button of navigation bar but no luck. Can you please suggest any idea. Here is my theme design.
style.axml:
<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="Theme.Splash" parent="#android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:windowBackground">#drawable/Splash</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primaryDark</item>
<item name="colorAccent">#color/accent</item>
<item name="android:windowBackground">#color/window_background</item>
</style>
</resources>
styles.xml:
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#fcce47</item>
<item name="colorPrimaryDark">#000000</item>
<item name="colorAccent">#000000</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:textCursorDrawable">#null</item>
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
I have write below code in styles.xml
you have to write below line inside mytheme.base
<item name="drawerArrowStyle">#DrawerArrowStyle</item>
you have to write below code in out side of the above style tag:
<style name = "DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">#color/BackButtonColor</item>
</style>