I want to use MdcTheme (to inherit the settings of the theme defined in the view system), but MdcTheme is deprecated and I can't see the preview of the composables.
So I followed this guide to update to the new dependencies:
https://material-components.github.io/material-components-android-compose-theme-adapter/
After doing so, Android Studio doesn't recognize the class androidx.lifecyle.Transformations anymore.
I googled a lot but didn't find any solution.
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
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.
I'm trying to design a GUI using the Android GUI builder in Eclipse. I want to use the android.support.design.widget.TextInputLayout, but I don't see it in the palette view.
I have already imported the appcompat_v7 library into the workspace as a project and referenced to it from my Android project;
I have already imported the design support library into the workspace as a project and referenced to it from my Android project;
I've set the build path to Android API level 23 (the newest at the moment) to prevent errors like No resource found... from being issued;
I've cleaned all my projects;
I've restarted Eclipse.
How can I make sure the TextInputLayout is available in the palette view?
I haven't found a way to get library widgets to work (though widgets from the project itself do show up – though they don't always work, seems to depend on the widget).
However, there is a workaround: if you add them to the XML file, you can view and edit them in the visual editor. You can add the widget entirely by hand, or find its "native" ancestor: According to the docs, android.support.design.widget.TextInputLayout extends LinearLayout, therefore simply drop a LinearLayout into your layout, then go to the XML and change
<LinearLayout ... />
to
<android.support.design.widget.TextInputLayout ... />
Eclipse may add a xmlns:app attribute to your top layout (and then complain about it being invalid). Simply change its contents to
xmlns:app="http://schemas.android.com/apk/res-auto"
Whenever you edit attributes, Eclipse will add another xmlns:app1 attribute – simply delete it and change your widget's app1:* attributes to app:*.
The whole thing is a bit buggy and requires manual intervention, but works eventually.
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'