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'
Related
In web development, I see how tags have default themes defined in the browser, and I see how they're applied.
However, with Android Studio's themes, I'm really confused. I can define my custom themes using ?attr/myClass, apply it on widgets by android:theme="?attr/yClass", and then assign a colour to that attribute in my day or night theme files.
But, what baffles me, is—that purple. Where does it come from? When I set the theme header to
<style name="Theme.TestingThemes" parent="Theme.MaterialComponents.DayNight.NoActionBar">
purples come for the not night mode.
When I use other styles that come with "default" with Android Studio, I don't see exactly that purple.
Some themes allow me to set my own colours, but some others don't, like the one that I mentioned.
Worst of all that totally blows my mind is: when I open the theme files in app/res/values/themes/* and app/res/values/colors.xml*, I only see less than 10 themes defined. Yet I see Android Studio suggesting to me a long list of colour names! Where do these come from?
I only use Vim as my text editor. I'm drowning in Android studio. It's cool and powerful, but I require some baby-walking assistance.
A default new project created in Android Studio has a colors.xml resource provided in the project (res/values/colors.xml), where the purple_500 and purple_700 you described are defined.
Any other colors and themes you see that aren't in your own project's files are in the AppCompat and Material Components libraries (defined as project dependencies in default new projects), or they're built into Android itself.
In the Projects panel on the left in Android Studio, if you expand External Libraries, you can see all the code libraries that are imported for your project as dependencies (these are defined in app/build.gradle and downloaded from the Web automatically). Among these dependencies are AppCompat and possibly the Material Components libraries, with their own provided resources within.
You can't modify the contents of the libraries. You're intended to customize by extending (making child styles and themes).
If you want to see where a reference is defined in Android Studio (in XML or other languages like Kotlin and Java), you can Ctrl+Click and it will jump to the line that defines it in whatever file it's in.
I've been developing with Android for a year and have honestly never bothered using material buttons.
You can create your own drawable file for the background of the button and then add that drawable to the back of a regular button in a layout. Don't let things like this frustrate you; there are so many ways of achieving the same outcome in Android :D
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.
I am using Android Studio 3.3.2. I didn't find the NumberPicker in the palette which was in Expert tab on older versions of Android Studio. What to do?Screenshot of my palette are given below:
Just type in <NumberPicker in the XML File and Studio will suggest the NumberPicker.
From there on you can adjust it also in the Design View.
I added a button and then had everything between the opening angular brace and forward slash deleted, then i simply typed NumberPicker (yes it was suggested) and vola! It appeared.
This is what my palette looks like, I want to know how to add other tabs like design and appCompact.
Thank you
I'm not sure I understand what you are asking. The palette cannot be modified and is a container for components such as button, texts, etc.
Please refer to this for intro into Android Development.
AppCompact is a support library that allows for themes, colors, widgets, etc. to run on earlier devices i.e. backward compatibility.
The design view is accessed through the res folder in the layout folder. By default, called activity_main.xml.
You should go through the basics of android development so you can understand the structure, components and overview of android Studio.
EDIT:
See this link which shows you how to create custom view components
Please view this link which goes over the entire overview of the UI and how to use and customise the UI layout design(Very Useful!).
The folks that works on Android Studio redesigned the Palette window in Android Studio 3.1.2. Some of these widgets have been completely taken out.
"There is a new "Legacy" section and the "Advanced" section has gone. Along with it the NumberPicker, DataPicker, TimePicker, TextClock, Chronometer and, as far as I can see, the Transitions category has gone completely along with all its widgets."
"If you rely on any of the missing Widgets then my advice is don't upgrade until a workaround has been made available. There is no word from the Android Studio team as to why these widgets have been removed and no word on how to put them back."
AndroidTagGroup is a widget for adding Tags. I am trying to use it in my app. I have added dependency compile 'me.gujun.android.taggroup:library:1.4#aar' , and am using it as
<me.gujun.android.taggroup.TagGroup
android:id="#+id/tag_group"
style="#style/TagGroup" />
But the layout is not getting rendered and is giving two errors,
Failed to find style 'tagGroupStyle' in current theme and Missing styles. Is the correct theme chosen for this layout? . I cant find any other theme related to TagGroup, the theme i am using is appTheme. I tried defining TagGroup style in the styles.xml, but no use.
Edit
The render error is shown in Android studio studio. Even if i build and run the app, I cant see the widget in the app.
Edit 2
As #CommonsWare suggested, after adding Tags i can see the widget in app. Only issue remaining is the rendering issue, which from the comments seems like a android studio issue.