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.
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 am very new to app development and I am facing this error in issue panel in android studio
Failed to find '#attr/shapeAppearanceSmallComponent' in current theme
i am also facing a warning
Missing styles. Is the correct theme chosen for this layout?
After searching on web i found that this is caused by the wrong theme selected in AndroidManifest.xml.
So as i can understand this:
There is a file for every theme and have some values defined in it.
Theme is defined in AndroidManifest file, is a way to tell compiler that theme related values are saved in given file.
For me i have selected wrong theme file and my app is trying to find an attribute #attr/shapeAppearanceSmallComponent which it can't find because it is not available in theme passed in AndroidManifest.
My app want this attribute as i am using something which need this to be defined (maybe like material TextInputLayout).
Still this is my theory, i am no where near any answer
Now things i want to understand.
: Even if there is a problem in my application, i am still able to compile it and deploy on a device and it is running fine, In which case i can have issue because of this error.
If my theory is right than i have few questions:
If i am using some element (Button or EditText), how would i know that which theme does it support
What if i want elements from different themes to be used in a single application.
One more thing i observed is that in drop down menu in design view for activity_main.xml after changing the theme to Material3.dark from MaterialComponents removes the error.
error image
no error image
If i change theme in design layout using drop down menu it won't change automatically in Manifest file. So will it be true to say that changing themes using that drop down menu is just telling me, how my app will look using that theme, and if it is showing an error i shouldn't use that theme and use one which is not giving any kind of render error.
I will post my AndroidManifest or my activity_main if required
I recently started to learn Android development. But when I click themes, to change it, it says:
Rendering problems. Missing styles....
Then I can't push any Layout or view into the app.
I tried clicking Auto add all the missing attributes, but it doesn't do anything.
One of them works though - only the Manifest Theme.
These screenshot might help:
Screenshot 1
Screenshot 2
See in the image click on Overscan then the dialog is propmt change the Theme to Holo light the error will disappear.
Image :
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'm new to Android development and I just installed Android Studio version 1.2.1.1. I created a project, HelloWorld, and chose the default blank activity, Darcula theme, and default API. Straight out of the box, without having written any code or touched anything, I get this message:
"Rendering Problems
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'textViewStyle' in current theme (4 similar errors not shown)."
I uninstalled and reinstalled Android Studio but I still get this error so I'm not sure what else I should do. It says "use the theme combo box... or fix the theme style references" and I'm new to Android Studio so I have no idea where the box is or how to change the reference.
Simply click on the Refresh icon at the review pane:
Android gives you the option to define your own style format, which the default project you made did. It created a style named 'textViewStyle'.
If you look at the text view instead of the design view (you can switch by pressing the tab at the lower left in the part where you get the error that it can't render) you will see that the textView or the app itself contains a line android:theme="#style/textViewStyle".
You can either remove this line, or track down the error in the styles.xml file in the res/values folder. This is the file that defines the style for the app.
If this doesn't help you it could be that the style is defined in your AndroidManifest.xml file, look at the tag, it will contain a line saying android:theme="#android:style/textViewStyle", change that to android:theme="#android:style/Theme.DeviceDefault" and you should be good to go.
More info on custom themes: http://developer.android.com/guide/topics/ui/themes.html
Since you are a beginner, more on general Android development:
http://developer.android.com
Make sure to select the correct theme from the menu in the preview panel.
If you set the layout file to be FullScreen in the manifest but select something like NoActionBar theme in the preview panel, you will also get this error.
Go to manifest file, check the theme you are using there and pick the same in the Design view of your xml file.
Rebooting Android Studio did the trick for me. I couldn't find the "Refresh" button in the accepted answer for some reason.
Click on "Design" tab
On the right pannel, search for the objet "text" that contains something like "#string/hello_world"
Remove this value from the field
There's no more error.