I used Theme.MaterialComponents.Light.NoActionBar theme and it seems to be affecting constrained layout which is some of elements(such as buttons) can not see in the "Design and Blueprint". But they are appearing properly when the app is running.
I tried the following steps but no use.
1) Try to clean the project
2) Try to invalidate and restart Android Studio
3) Try Rebuilding the project
I tried adding Base key word but it seems to be wrong.
<style name="AppTheme" parent="Base.Theme.MaterialComponents.Light.NoActionBar">
I'm currently using the latest dependency which is 'com.google.android.material:material:1.1.0-alpha07'
It seems to be ok with early dependency such as 'com.google.android.material:material:1.0.0' but I'm wondering why it is not working with the latest releases.
I could use different theme which do not have material components and overcome this problem as well, but it is not what I'm expecting.
Your answers and comments are highly appreciated.
This issue is directly related to the version of material design. I used the latest version of android studio with latest version material design in the constraint layout. The same issue happened when I dropped a button from the palette to layout, it made the layout vanish and I changed the theme to the default, it also worked fine. But as u said, I should use material design. When I used latest material design version( com.google.android.material:material:1.7.0), it didn't work but when I used com.google.android.material:material:1.5.0, it worked fine. That's why u can change the version to find the one which is compatible and not buggy.
Related
preview of design using xml is not showing com.google.android.material.card.MaterialCardView, but its shown when we install the app.
make sure you are using this dependency in your build.gradle(Module:app)
implementation 'com.google.android.material:material:1.0.0'
or any version of this dependency.
see here
The theme on the layout preview windows needs to be or extend a Theme.MaterialComponents theme. Sometimes the theme in your layout preview doesn't reflect what's the actual theme of your app or view.
If you change the theme on your picker to a theme that is or Extends Theme.MaterialComponents the preview for the MaterialCardView should show.
The problem with this is that you just fixed for your machine and for a particular instance of Android Studio. Is very easy that config gets lost.
To avoid this and make it work on any machine you can place this on the root view of your layout file:
tools:theme="#style/YourMaterialComponentsTheme"
The tools namespace is just for preview purposes. If you really want this theme to take effect when you run the app on your device replace tools with android, but I wouldn't do this unless you know what you're doing in terms of themes and styles.
Method-1
Invalidate cache & Restart
Method-2
Make a backup of project
delete .idea folder & .iml file and re-import project
So i want to add Bottom Sheets in my app and looked into the material design steps for doing so but the problem is I am unable to add attributes like app:behavior_hideable , app:behavior_peekHeight, etc .
I have looked in others code as well but didn't found anything solution to it.
implementation 'androidx.appcompat:appcompat:1.1.0-beta05'
implementation 'com.google.android.material:material:1.1.0-alpha07'
I have included the latest dependencies available to me at this time.
Still there isn't any positive breakthrough.
Well I think that somehow android studio was not auto-detecting those attributes .
So, by just sheer luck i tried to copy paste those attributes from Material design site (https://material.io/develop/android/components/bottom-sheet-behavior/) and that seems to work just fine.
Hope this works for you as well.
Here is the screenshot of that screen,after installing Android Studio 3.0 i face this problem.
Click on the theme selector in the preview window ("MaterialTheme") and select an AppCompat one (or make your theme have that as parent).
The support components won't get rendered unless you select an AppCompat theme. I guess the MaterialTheme is your custom one, so just make sure it uses the appropriate theme as parent.
I have a question about theme for Android app in Android Studio. When I'm creating a new project I would like to have an material design theme, but I don't get this activity theme to choose.
On first picture you can see my view for adding an activity and on second picture what I would like to have.
My current view
Material design view
Does anyone have a solution how to set up Android Studio so I can have a view which is showed on second picture?
I found the answer to this question.
To have this Project Template (Material design) available in Project Wizard, you need to have Android Studio version 1.4 or above.
For details see this link: Android Studio 1.4 Release
I don' t know if my as show that in the wizard. Bit materiale is a style. And this style is a guide line recommend by google. So you can make your app with material design also writing the code. For example you can use a floating action button, or a combo of beautiful color or pit simple animations inside yours views or using cards in listview.
If you have latest updated Android API, SDK, then you will get the material design by default; even if you would not use wizard for adding an activity.
Not sure if I'm barking up the wrong tree here, but just for reference, here are the Android SDK components I've got installed:
Here is the buildscript, android and dependency sections of my build.gradle:
And last but not least, Android Studio version:
If you couldn't find the tool fix, you can anyway inherit your activity from appcompactactivity.
And change your androidmanifest as follows to get material design feel
<application
//your stuff
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
Don't forget to add the following depenency in build.gradle and sync
compile 'com.android.support:appcompat-v7:22.0.0'
i recently updated the appcombat library to integrate the material design.
But there is an issue with the style "Theme.AppCompat.Light.DarkActionBar", because if i use this style and let my TextView like:
android:textAppearance="?android:attr/textAppearanceSmall
the whole text appears invisible (or just white) on a white background
If a use the "Theme.AppCompat.Light" theme, everything is working fine.
This issue i have only on Devices running android 2.3.*
Samples: (Don't have enough reputation to post images, so you need to click)
DarkActionBar:
Light:
Any suggestions guys? Anyone tried the new appcombat library with Gingerbread?
Obviously i found out that i need to use material text appeareance, for instance:
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
See also:
http://www.google.com/design/spec/style/typography.html#typography-roboto-noto