Questions tagged [material-components-android]
Material Components for Android (MDC-Android) help developers execute Material Design. Developed by a core team of engineers and UX designers at Google, these components enable a reliable development workflow to build beautiful and functional Android apps.
material-components-android
1,361
questions
0
votes
0
answers
40
views
Why could not inflate Behavior subclass com.google.android.material.bottomsheet.BottomSheetBehavior?
My intention is: when I press the buttom labeled "STANDARD BOTTOM SHEET", I want the Standard sheet dialog to be shown.
I'm trying to use a bottom sheet modal dialog, but for some reason, ...
-1
votes
0
answers
19
views
material3 TextInputLayout actual text overlaps with prefix when it's inside recycler view
I'm using TextInputLayout and TextInputEditText as item layout inside a recycler view. the recycler view has 9 items, the first 4 items that are shown have no problem, the problem is within items 5,6,...
0
votes
1
answer
19
views
How can i implement a tab selector for BottomNavigationView?
Hellow there,
i just wanna implement a tab selector for BottomNavigation view like this:
At the moment i don't care about the item animations, i only want to put the bottom rectangle for the selected ...
1
vote
0
answers
18
views
How to change rounding of the Android Material range sliders
I haven't found any information on how to change both the active and inactive tracks corner rounding for Android Material range sliders ; how do I do that or work around it?
I have read:
Android ...
0
votes
1
answer
33
views
Must I use MaterialTheme.typography when using Jetpack Compose, or are there any alternatives?
Recently, I have switched to Jetpack Compose, I see that it's very convenient and faster when building UI with Compose. But I find it difficult and confusing to decide which style of Text should use ...
0
votes
1
answer
27
views
How to show border on TextInputLayout in Android Kotlin without MaterialComponents support
How to show border on TextInputLayout in Android without MaterialComponents.
I have an AppCompatActivity using AppTheme.DialogTheme to show the Activity as a Dialog, but this configuration does not ...
0
votes
0
answers
57
views
Why are Dynamic Colors not working on my android 14?
I want to use dynamic colors in my app with java and I use
DynamicColors.applyToActivitiesIfAvailable(getApplication());
to apply them, but colors doesn't change as in my phone's other apps
except ...
1
vote
0
answers
33
views
MaterialAlertDialog not showing singleChoiceItems nor multipleChoiceItems
I'm using Java to develop Android apps. In my current app, I want to create a custom alert dialog based on MaterialAlertDialogBuilder to reuse across the app and reduce repetitive code. The problem is ...
1
vote
1
answer
109
views
LargeTopAppBar is collapsible even if the inner content is not scrollable in Jetpack Compose
I am trying to implement a screen that uses TopAppBar and some items with LazyColumn.
However, LargeTopAppBar is collapsible even if the inner content is not scrollable.
STEPS
I made a scrollBehavior ...
0
votes
1
answer
38
views
MaterialAutoCompleteTextView automatically shows dropdown when changing theme
I'm using MaterialAutoCompleteTextView to display a dropdown list for selecting a theme.
xml:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/...
0
votes
0
answers
42
views
Transition from Activity to Fragment
How to create a transition from an Activity to a Fragment?
I specificly tried to create a MaterialSharedAxis transition from an Activity to a Fragment which did not work for me.
Sample Code:
// ...
-1
votes
1
answer
199
views
Fatal Exception: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f040109 a=23}
I am facing an error message which triggers whenever I click in a MaterialDatePicker. I think it is related with the ThemeOverlay but I have no idea how can I get rid of it.
This is the error message:
...
-1
votes
1
answer
40
views
Switching between list view and grid view in android efficiently with smooth transition
I am trying to achieve a view switch that enables user to switch between "List view" and "Grid view" in Android. However, I have achieved this but I am not satisfied with results ...
2
votes
1
answer
177
views
Updating Jetpack Compose broke dynamic colors
In my Android Project I was using the Compose BOM 2023.08.00 version, and now I updated to 2024.04.01, but after doing so, dynamic colors no longer work. Instead, it shows gray (which isn't the ...
1
vote
1
answer
118
views
Material Design scroll-away searchbar with recyclerview
I would like my Material Design Searchbar to scroll-away/collapse when scrolling down in my recyclerview. I followed the guidelines from here but I can't get it to work.
My activity XML:
<?xml ...
1
vote
1
answer
63
views
How do I set the checked icon of a Chip programmatically?
Is there any way to set a drawable xml asset in a chip programmatically?
Just playing around with chips, not forced to use them actually. I can easily swap, but i was wondering if that's possible or ...
0
votes
3
answers
173
views
How to Enforce ColorAccent in Dialog Buttons Across Different App Themes?
I expected the dialog's button text to use colorAccent.
However, in some app themes, the dialog's button text uses colorPrimary.
Here are my findings:
Theme.AppCompat.Light.DarkActionBar - Dialog's ...
0
votes
0
answers
34
views
The default top app bar color changes after updating material version to 1.11.0
I designed my app to look like this:
But after updating the material library version from com.google.android.material:material:1.10.0 to com.google.android.material:material:1.11.0 the top app bar ...
0
votes
0
answers
37
views
Rule of thumb for smoothing angle between two lines `shapePath.lineTo` in java/kotlin
I want to make smooth the angle between two mirrored lines shapePath.lineTo(x1,y1) and shapePath.lineTo(x2,y2) by adding an arc of given radius R between that two lines. But I don't know how to work ...
0
votes
0
answers
34
views
Android BottomSheetDialog: Background blinks between bottom sheet and keyboard when keyboard is expanding (XML)
I have simple bottom sheet with one input field. When it opens I also show keyboard. Here is the sample code.
MainActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(...
0
votes
0
answers
32
views
Tab ItemIndicator not visible - Android TabLayout
I'm trying to display a white tab indicator that's 1 dp in height and extends the full width of the tab.
However, nothing is being displayed except the text
layout.xml
<com.google.android....
0
votes
0
answers
132
views
Styling Android Material Time Picker
I'm new here and seeking guidance on styling a time picker to match a specific design. I'm working on a Android kotlin project, and I want to achieve a look similar to the following image:
However, I'...
1
vote
2
answers
139
views
(BottomNavigationView) The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
When using com.google.android.material.bottomnavigation.BottomNavigationView in my app layout, I get the following error:
Caused by: android.view.InflateException: Binary XML file line #25 in com....
0
votes
2
answers
152
views
How to change CheckBox icons more effectively in jetpack compose
ok so i have two rows of checkboxes that the user can either press checked or uncheked to each individual column so i came up with this idea of code :
fun HowAmIDoingComponent(
modifier: Modifier =...
0
votes
1
answer
365
views
How to make a mini player like YouTube Music or YouTube in Android Jetpack Compose while having bottom navigation bar?
Using Material3 design principle, I think (I may be wrong here) BottomSheetScaffold Composable should be used rather than ModalBottomSheet Composable, but the problem is that I didn't find any way of ...
0
votes
1
answer
60
views
How to Disable or Customize Shadow Effect in Material Design Components for Android Studio
I'm developing an Android app using Android Studio, and I'm using Material Design components, specifically BottomNavigationView. I want to disable or customize the shadow effect on this ...
1
vote
1
answer
125
views
Material Design SearchView has no method "setOnQueryTextListener"
I am struggling to implement material components search in my android app following this tutorial
I built a basic app with viewbinding, added implementation 'com.google.android.material:material:1.11....
0
votes
1
answer
130
views
How to change inflated toolbar item icon color in Actionmode from App Theme
This is the main theme we use for all our apps:
<resources>
<!-- Learn more about theming: https://m2.material.io/design/material-theming/implementing-your-theme.html#color -->
<...
0
votes
0
answers
32
views
AutocompleteActivity with Compose : IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents
We are in the process of migrating our app from XML to compose and migrated a lot of areas in the app.
right now we need to implement Autocomplete from Google Places to one of our Compose screens ...
0
votes
0
answers
29
views
Toolbar small to Medium by Text Lenght
I'm developing a toolbar that adheres to MD3 guidelines, but I'm unsure if this aligns with the intended use.
The toolbar will dynamically change its title based on server-received data. This text ...
0
votes
0
answers
62
views
The implementation 'com.github.prolificinteractive:material-calendarview:versions has problems on layout
I want to use material-calendarview library on github(https://github.com/prolificinteractive/material-calendarview)
but I think I have some problems about implementation/version. Documentation says ...
0
votes
1
answer
227
views
how can i draw a border between DropdownMenuItems in jet pack compose?
how can i draw a border between DropdownMenuItems in jet pack compose?
I want to draw a bottom border or a border between the diferent items in a DropDownMenu in jetpack compose in my Topbar Menu.
I ...
1
vote
0
answers
130
views
Android Compose Error for CoreTextField -> CoreTextField -> semanticsModifier
I get the following error when switching from Fragment to Compose view and this is experienced by many users.
I couldn't solve the error because I don't use TextField within that page or any page it ...
0
votes
0
answers
569
views
Facing issue with ModalBottomSheet in Jetpack Compose. Scrim color is not animating while opening and closing of sheet and white line on right corner
I am using ModalBottomSheet but I am facing two issues:
There is a white line on the right corner of the scrim
The scrim color is not animating while opening and closing of ModalBottomSheet
val ...
0
votes
0
answers
33
views
No action bar with Theme.MaterialComponents
I am running an old Android app through lint, prior to issuing an updated version.
Lint recommended changing Switch to SwitchMaterial: I did this, and got a runtime error when the app tried to invoke ...
0
votes
1
answer
118
views
ShapeableImageView - Changing height results in cut-off corners when applying new ShapeAppearanceModel
My app needs to support multiple corner radius/aspect ratio combination presets which may be displayed in different orders depending on the user profile being displayed. For example, preset A has ...
0
votes
1
answer
500
views
android studio - fail to build project after Material dependency upgrade
The requirement is to upgrade all gradle dependencies of an old android app.
Managed to upgrade all to latest and is able to build and run the app.
When I upgraded the Material dependency from com....
0
votes
0
answers
283
views
Why my modal bottom sheets don't show Drag handle?
For some reason, the Drag handle is not visible on my modal bottom sheets.
My main theme is a descendant of the Theme.Material3.Light.NoActionBar.
The bottom sheet style is added to the theme:
<...
1
vote
1
answer
512
views
Don't work reCreate() activity with jetpack compose for android 13(API 30)
Don't work SetContent{} function when i call recreate function for change my app theme
Hi there
i try to change theme in my app that developed with jetpack compose(material v1.2.0-alpha12) and android ...
0
votes
1
answer
56
views
Android OutlinedBox style is not work in TextInputLayout
I have searched and tried many solutions, but it still not work.
(Still shows "FilledBox" style)
What is the problem in my code?
input_layout.xml
<com.google.android.material.textfield....
0
votes
1
answer
509
views
Android Native Jetpack Compose OutlinedTextField Selected By Default
In Android Native Jetpack Compose, using the material androidx.compose.material3.OutlinedTextField composable, is there some way to cause the default value I put in the field to be selected as soon as ...
0
votes
0
answers
32
views
CoordinatorLayout Behavior not working when RecyclerView or NestedScrollView scroll programmatically
I have AppBarLayout and BottomNavigationView that both collapse during scroll.
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout ...
0
votes
1
answer
73
views
Material Dialog - How to change color of Checkbox in single choice items?
I am trying to change the color of radio button for Material Dialog, what possibility I found in the documentation here and here is to override the whole layout using app:singleChoiceItemLayout but is ...
-1
votes
1
answer
280
views
How to implement the Search View Docked mode
Currently, I am using the Material 3 library to code my application's design.
In the official Material 3 website (m3.material.io), in the Search section, at the bottom there is a picture of a Search ...
0
votes
1
answer
34
views
Textfield hint in Android Studio is not positioned properly
When I type in the Material UI Textfield, the hint is not positioning itself properly.
As you can see in this image, the hint is not properly positioned as it goes more left. I am just trying to do ...
1
vote
0
answers
46
views
Incorrect Colors in Jetpack Compose Preview and Physical Device [duplicate]
I'm facing an issue with colors in my Jetpack Compose app. Both in the Android Studio Preview and on my physical device (Samsung SM-G780G - Android 13.0), the colors are incorrect. In the Preview, the ...
1
vote
3
answers
314
views
MDC: Material3 MaterialCalendar Background Color
How to change Material Calendar background? I am setting a day and night theme and it is working except for the night mode where the set color background is not applied correctly.
This is the expected ...
1
vote
1
answer
1k
views
Edge to Edge Theme for Background of Android Activity to Hide Status Bar Scrim During Fragment Transitions
I have 1 activity that hosts multiple fragments in a navHostFragment. To switch between them I use androids Navigation Component (i.e. navGraph).
Now I want to enable edge-to-edge. I already have it ...
0
votes
0
answers
69
views
How can I equally space items of BottomNavigationView
I am using a BottomNavigationView from material library, how can I evenly distribute the buttons of the BottomNavigationView in tablet mode, instead of having all the buttons centered?
This is my XML
&...
0
votes
0
answers
66
views
Material catalog draggable layout stops working when view is added
I'm using the DraggableCoordinatorLayout from the Material Components Catalog to create a set of draggable views (material CardView) that can be dragged around like stickers, it works properly when ...