Questions tagged [android-styles]

A style is a collection of properties that specify the look and format for a View or window

android-styles
Filter by
Sorted by
Tagged with
0 votes
1 answer
369 views

I cant use from style OutlinedBox Dense - Android

I am using from this style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox.Dense" but get me bellow error: Caused by: android.view.InflateException: Binary XML file line #26: ...
jo jo's user avatar
  • 1,818
0 votes
1 answer
883 views

Customize DatePicker color

I've a DatePicker inside xml, so it's not a dialog, just a component inside my layout. My main theme is extending from Theme.MaterialComponents.Light.NoActionBar. How can I change the color of my ...
Jumpa's user avatar
  • 4,369
0 votes
0 answers
164 views

ImageButton tint selector is not changing color based on state

I want to change ImageButton icon color tint based on Button state. Its working with background for generic Button, but for ImageButton icon, its not working at all. Its still in "enabled" ...
Martin's user avatar
  • 2,678
2 votes
0 answers
616 views

How to hide android SplashScreen or make it transparent when starting an app?

Recently I got a issue with Android S. When I start my app, it will show a splash screen before MainActivity, and the color of this splash screen was set to be the background color of MainActivity. Is ...
JavaForeverGod's user avatar
0 votes
1 answer
88 views

How to center spinner items using styles.xml?

How to center spinner items through styles without creating custom item view? Without extra work in code, just using styles.
Mikhail's user avatar
  • 3,002
2 votes
3 answers
2k views

Set all text style changes in one place in Compose UI similar to styles.xml

Previously you could define all of your style changes as a single style in XML which was really convenient especially if you had a lot of different styles. The project I'm currently working on has 50+ ...
smoothoperator's user avatar
0 votes
2 answers
214 views

Style are not applied in Kotlin

I have created a button style defines in the themes.xml as below: <style name="MyAppTheme.Button" parent="Widget.AppCompat.Button.Colored"> <item name="...
Seb's user avatar
  • 3,097
2 votes
0 answers
287 views

MODE_NIGHT_FOLLOW_SYSTEM not working after MODE_NIGHT_YES

I have the next code to force dark mode depending the store of the user. if (storeProvider.shouldForceDarkMode) { appProvider.theme = AppProvider.AppTheme.DARK AppCompatDelegate....
Rubearen's user avatar
0 votes
1 answer
148 views

Android change Dialog background color from app settings via styles

I want to change default Dialog background color of my PreferenceActivity (Dialog that opens where we choose option from list in settings). Now the background of Dialog is always white although I ...
Qbi's user avatar
  • 485
0 votes
0 answers
43 views

How so we set actionbar homeasup enabled in AppTheme/Style

Programmatically it can be achieve by actionBar.setDisplayHomeAsUpEnabled(true); Is there a way to set it in the app theme xml eg <style name="Theme.FooBar" parent="@android:style/...
Bret Joseph's user avatar
0 votes
0 answers
278 views

How do I access the style attributes of my App theme in my BottomSheet theme?

I'm using style attributes throughout my app to support multiple themes. But now I'm facing an issue while creating a bottom sheet. I'm not able to use my app theme's attributes (Such as ?attr/...
rdias002's user avatar
  • 214
0 votes
1 answer
2k views

Android Webview net::ERR_UNKNOWN_URL_SCHEME

Could you give me a hand? I have a WebView display page, and when I click on buttons like (Join our telegra channel or share articles via Whatsapp and other social networks) this error appears: net::...
Salvatore Arena's user avatar
1 vote
1 answer
768 views

Actionbar background style not changing in dark theme

Creating the first app, I changed the actionbar's background to teal. The problem is that it worked on light theme but not on dark theme. Tested on both pixel 3 XL emulator and 2 different samsung ...
AlikElzin-kilaka's user avatar
2 votes
1 answer
1k views

MaterialButton style being overridden, how do I keep it?

I'm trying to use a MaterialButtonToggleGroup inside my BottomSheetDialog. However the style for the button is being overriden by the current theme I'm using for the BottomSheet In a regular fragment: ...
DIRTY DAVE's user avatar
  • 2,529
0 votes
0 answers
228 views

Android. Style for DialogFragment not working

I have project with two modules: app and design_utils. Inside my app module I use DialogFragment. I need to set style for my DialogFragment views from design_utils module. In turn, the design_utils ...
testivanivan's user avatar
  • 1,220
0 votes
1 answer
634 views

How to set the font of TextInputEditText in theme.xml?

I want to apply the font to multiple TextInputEditTexts in common using style. However, there is TextInputLayout in parent, but TextInputEditText cannot be found. (Even if the font is applied to ...
ybybyb's user avatar
  • 1,545
0 votes
1 answer
83 views

How do I access the default android style from code?

I'm trying to write my own version of android.widget.SeekBar by modifying the android source code: I can't use a derived class because I want to override some behaviour using private member variables ...
Richard Parkins's user avatar
0 votes
1 answer
39 views

Are there any difference between `Widget.MaterialComponents.LinearProgressIndicator.MyStyleName` and `MyStyleName`?

Are there any difference between Widget.MaterialComponents.LinearProgressIndicator.MyStyleName and MyStyleName? <style name="Widget.MaterialComponents.LinearProgressIndicator.MyStyleName" ...
Taha Sami's user avatar
  • 1,589
1 vote
1 answer
429 views

How to reset android:stateListAnimator from null to the default style of the button in Android`

I implemented a costumized "enabled" button in Android. I set android:stateListAnimator="@null" when my button is disabled and want to reset it to the default Widget.AppCompat....
user650708's user avatar
1 vote
0 answers
584 views

How to replace, overwrite or change defined composables

I'm new to android compose and I think I understood the general idea. Instead of defining my UI in an XML file, I basically "write code" that describes my UI. However, in my XML files, I ...
Benjamin Basmaci's user avatar
2 votes
1 answer
341 views

Material DatePicker Disable year option

I've got the following code: private void openDatePicker() { MaterialDatePicker picker = MaterialDatePicker.Builder.datePicker() .setTitleText("Select date&...
igodie's user avatar
  • 527
1 vote
2 answers
1k views

Separate day/night selector for button text color

I created a custom selector for button text color: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">...
Jeff L's user avatar
  • 555
0 votes
1 answer
35 views

How to make a left side curve as if it were a U without absolute position?

I want to make the curve that appears in the image, the one that has the gray color brackground that makes like a U. Without an absolute position for me, then I can use a button above that same ...
fanjiooJr's user avatar
  • 309
0 votes
0 answers
633 views

Android. Custom font not working when setting from style

I'm trying to set programatically style for my button. Here is my style: <style name="MainButton"> <item name="android:background">@drawable/bg_button</...
testivanivan's user avatar
  • 1,220
0 votes
2 answers
1k views

Android. How to programatically change background color of button

I need to create Button programatically. And my button can be randomly colored. However, I need to set the background color of the button and also the background color when the button is in a state ...
testivanivan's user avatar
  • 1,220
2 votes
1 answer
787 views

You need to use a Theme.AppCompat theme (or descendant) with this activity - can't find issue

In my app, I'm finding some users are crashing with You need to use a Theme.AppCompat theme (or descendant) with this activity on my MainActivity's onCreate(). The problem is that only some users ...
SmallGrammer's user avatar
  • 1,113
0 votes
1 answer
443 views

ANDROID - How to apply a different theme to a product flavour?

I'm not very familiar with working with product flavours and applying different themes to them. Basically I'm working on an app that is going to have a reskin to a different set of colours/themes. The ...
SmallGrammer's user avatar
  • 1,113
0 votes
2 answers
211 views

Device theme mode does block app theme mode. Android Studio Java

I started to implement Night/Light mode inside my android app by using this tutorial. But devices has this function by system. The problem is that the system night mode does block my code in app. How ...
Oleh Prukhnytskyi's user avatar
1 vote
1 answer
531 views

Android 12 - Override default splash screen logo using splash screen api setSplashScreenTheme fails

I trying to override the default splash logo using SplashScreen API, setSplashScreenTheme. But it fails to set overridden logo but takes the default application logo. Is there way to override default ...
MGK's user avatar
  • 7,068
1 vote
1 answer
761 views

SetTheme does not work when using viewBinding

I have two themes in my app (dark and light mode) and I could change the themes without any problem. But, since I used the viewBinding, the setTheme() function did not work and I can't change the ...
A.Hosein's user avatar
  • 182
2 votes
1 answer
2k views

How to make a Splash screen the proper way i.e. not to make it a part of the app process?

I am new to android. I want to add a splash screen to my app. I went through this official documentation. It says When a user launches an app while the app's process is not running (a cold start) or ...
Ronnie's user avatar
  • 235
0 votes
3 answers
750 views

How do I add back the transparent background around my dialog activity with a custom theme

I have an activity and I've set it's theme in the manifest to a custom dialog theme. But now the transparency around the dialog box is gone. Everything is black. Here's what it looks like with my ...
Laila Campos's user avatar
0 votes
1 answer
51 views

How can i apply theme what is in my mind in the android application

I am really struggling in theming my android application, i can't understand that how the theme and styles are structured in android, and when to use theme or style for the views. <resources xmlns:...
aman sharma's user avatar
5 votes
3 answers
982 views

Problem with Translucent Navigation bar in Android

I'm using Translucent Navigation bar by adding below attribute to make my app mobile nav menu looks like some Google apps where mobile nav bar is a bit transparent and content will visible through it. ...
Real Tech Hacks's user avatar
0 votes
0 answers
35 views

Overflow button color not changing / overflow button not visible

So , I have an overflow button in my app which looks like this : so as you can see in android studio the overflow button is visible , just like how I want it to be but when I run the app on my phone ,...
Lak's user avatar
  • 35
0 votes
2 answers
488 views

Cannot resolve symbol '@style/Base.AlertDialog.AppCompat'

I'm trying to run my Android project and then Android Studio shows me the following error: Cannot resolve symbol '@style/Base.AlertDialog.AppCompat' <style name="AlertDialog....
Miliyon Berhanu's user avatar
0 votes
1 answer
181 views

How to center title in default toolbar without custom layout?

I have this Theme and want to center the title in the default toolbar. This means that I have no Toolbar in my XML file. This is what I have tried: <style name="Theme.MyApp" parent="...
Always Learner's user avatar
1 vote
0 answers
165 views

How to add TextView style that depends on the application theme android

In my fragment i have 2 TextView with black (Primary) and grey (Secondary) colors in light theme and also white (Primary) and grey (Secondary) colors in dark theme. I have added new styles for ...
onesector's user avatar
  • 400
5 votes
5 answers
478 views

Changing bottom navigation bar icon colour?

This is what my bottom navigation bar looks like at the moment: Looks great right? Except that, right now you can see each icon clearly (or mostly clearly), however when you view it on my device you ...
JamieRhys's user avatar
  • 276
2 votes
1 answer
285 views

Change EditText long click menu text color

For some reason the menu that comes up on long click (for copy/paste/cut/etc...) in my EditText have white text color on a white background so it's unreadable. I searched quite a lot on this forum ...
holparb's user avatar
  • 169
2 votes
0 answers
194 views

Disable darkmode for textColor edittext

disabled the dark mode for the application with <item name="android:forceDarkAllowed">false</item> But in the input in the case, when you need to remove Span, the textСolor is ...
RusyaMed's user avatar
  • 151
0 votes
0 answers
76 views

How to add a glass effect on views in android? [duplicate]

How to achieve a glass-like effect on views in android like the one that can be seen in the provided picture?
Tom Shaw's user avatar
  • 139
1 vote
1 answer
659 views

How to make FloatingActionButton a Square with the Material Library? [duplicate]

I'm trying to make by FloatingActionButton a square using the material library in my styles: <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <...
DIRTY DAVE's user avatar
  • 2,529
2 votes
1 answer
1k views

How to change colorPrimary programmatically with a color given from an API?

I need to change the colorPrimary and colorAccent programmatically. The color values are fetched from a web service once we login to the application. These values will be any, because it is setting ...
KIRAN K J's user avatar
  • 692
1 vote
1 answer
788 views

Getting toolBar elevation in dark mode with material styles (PrimarySurface)

According to Material documents you could use "PrimarySurface" styles for components like toolbar and tab layout to switch their background color between color Primary and Surface in light ...
Prs2's user avatar
  • 113
0 votes
2 answers
443 views

Wrong colorAccent when retrieving from theme

I want to use colorAccent from application theme. There are two themes with different accent colors. I am implement it with this code: Styles: <style name="BaseAppTheme" parent="...
BArtWell's user avatar
  • 4,194
0 votes
2 answers
120 views

Created a custom layout dialog, but not able to dismiss dialog when clicked outside dialog window

**Please help me out where I have done wrong** I am not able to dismiss dialog when clicked on the outside area on my screen only dismissed when I press backpress in mobile keys. Dialog ...
Nitz_with_u's user avatar
1 vote
0 answers
159 views

Android TextView using style attribute doesn't stay in one line

I'm pretty new to Android, and trying to define a style for my layout. My layout is as follows: <?xml version="1.0" encoding="utf-8"?> <com.google.android.material.card....
Yaels's user avatar
  • 13
0 votes
1 answer
1k views

Android. How to increase splash screen duration?

I am using the single-activity approach. I need to display a splash screen. For this I am using the following code: <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"...
testivanivan's user avatar
  • 1,220
0 votes
1 answer
467 views

Change TextAppearance of all text of application programmatically

In an Android application I have 24 themes (12 themes for day, 12 themes for night), for example Blue, Black, ... and user can change application theme at runtime. Now I want to enable user to change ...
hasanghaforian's user avatar

1
2
3 4 5
39