I updated my android studio to Dolphin. I have some ui issue:
1.Infinite cycle trying to resolve '?textAppearance': Render may not be accurate.
2.Failed to find '#android:attr/textAppearance' in current theme.
This happens for a reason: There may indeed be styles missing.
Theme.MaterialComponents.Bridge & Widget.MaterialComponents
For example, when applying android:theme in XML:
android:theme="#style/AppTheme.FloatingActionButton"
But the referenced material style does not define any #android:attr/textAppearance:
<style name="AppTheme.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
<item name="android:textAppearance">#style/TextAppearance.AppCompat</item>
</style>
The style attribute might be missing somewhere else, than where the render error occurs.
When FragmentContainerView won't render, see app:startDestination and its tools:layout.
Searching for string android:theme in directory res/layout should turn up all the references.
I changed it compileSdkVersion 33 from 32 it works but neomorphism attributes are missing now.
Related
In my current project, when I select the Design tab in Android Studio 2.2.2 for a particular layout I get an error that says
Missing styles. Is the correct theme chosen for this layout?
and it goes on to say
Failed to find style 'textEditSuggestionItemLayout' in current theme
(42 similar errors not shown)
But, the actual layout renders OK in the Designer and at runtime.
There are lots of other S.O. posts on this, such as here and here and most of the answers seem to involve clearing the caches and restarting Android Studio, or selecting a different theme from the dropdown. I I have tried the first one but it didn't help. I haven't tried the second one yet because I don't really understand what a theme is.
Questions:
The error implies that there's an error in the theme itself. What
is that? Is the theme file part of my project, i.e., is it one
that I should be creating, editing, and that gets built and shipped
as part of my APK or is it only used in the developer IDE?
If I select a different theme from the dropdown how do I know what the
"correct" one is?
Since my project builds and runs OK as is, can I just ignore these
errors? In other words are these errors in my code or just a
problem with the development environment?
Edit: Some additional information after responding to comments, below:
The only place the string 'theme' is used in my manifest is
android:theme="#style/Theme.FullScreen"
... and FullScreen is the theme specified in the dropdown.
I did a search in my project for the string "textEditSuggestionItemLayout" and Android Studio found no occurrences of it.
If you've recently updated AS or any of its components, then try to 'Invalidate caches & restart'.
Else, try choosing AppTheme from the Design tab or change it to AppTheme from the default one. Choose the one that conforms to your parent app theme in your styles.xml.
The cause of the error could be anything from malfunctioning IDE to selecting a theme not mentioned in your styles.xml (most likely).
You could do a project-wide search for textEditSuggestionItemlayout, or the other styles that it claims to miss.
These are either in your own res/values/styles.xml and/or res/values/themes.xml files, or they are provided within the SDK, which is why you see some suggestions to uncheck 'Automatically Pick Best' and pick a version you have installed. In some cases, the latest API version's rendering tools don't work.
As an example, if you have your style set at Theme.Holo, but you are using the AppCompatActivity, you'll get a rendering error that you must use a Theme.AppCompat (or descendant). These themes are changeable from the dropdown of the design editor.
You can see what themes/styles are applied to your Activities within the AndroidManifest.xml.
res/values/styles.xml
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/PrimaryColor</item>
<item name="colorPrimaryDark">#color/PrimaryDarkColor</item>
<!-- Customize your theme here. -->
</style>
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
Note: android:theme= and #style/
If you are still missing themes, then you may be missing some dependency, such as
compile 'com.android.support:design:<your_version_here>'
If your code runs fine, then sure, ignore it, but I think getting the layout designer working again shouldn't be ignored.
What causes the following error in the layout preview in Android Studio?
Rendering Problems The following classes could not be found:
- android.support.v7.internal.app.WindowDecorActionBar (Fix Build Path, Create Class)
Tip: Try to build the project.
The Actionbar has been deprecated and replaced by Toolbar. That being said, you can do the following if you want to continue using Actionbar for now:
Open styles.xml in the values folder inside the res folder.
Add the word Base to the beginning of the theme name so that it reads "Base.Theme.AppCompat.Light.DarkActionBar"
I had the same issue today and this solution worked for me. FYI I am in Android Studio though, but hopefully,the solution is similar for Eclipse.
FYI here is a decent blog post on replacing the Actionbar with the Toolbar for when you are ready to do so: https://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/
I think you must be depending on "com.android.support:appcompat-v7:23.1.1" in your module settings.
ActionBar has been deprecated.
Just change your dependencies from 'com.android.support:appcompat-v7:23.1.1' to 'com.android.support:appcompat-v7:23.0.1' in "build.gradle".
You can also change your style parent to "Theme.AppCompat.Light.NoActionBar".
Try to use the Toolbar instead of ActionBar.
This one works for me
Changing AppTheme parent in res/values/styles.xml resolved this problem. Replace
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
with
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Or you can change API level 21 from list.
goto: res-->values-->styles(V21)-->
Code
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
</style>
select your theme as Apptheme.NoActionBar in preview. Because ActionBar is depricated, welcome back to ToolBar. NO need to change your dependencies in build.gradle(Module:app).
from com.android.support:appcompat-v7:23.1.1 to com.android.support:appcompat-v7:23.0.1.
Hope this will help you!!!
I had a similar issue, and as many have said since ActionBar has been deprecated the trick was to specify
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
NOTE: that the parent ends in .NoActionBar.
Since ActionBar has been deprecated Android has gone into using ToolBar which you can read about here on the developer.android.com
I tried specifying
<style name="AppTheme.NoActionBar">
As a another post stated and that threw errors. Though others may not have that issue.
I have the same problem in Android Studio 1.5 (even with AppCompatActivity), and my attempt to solve the problem was to update my Android Studio to 2.0. It solves the problem in my case. You can found the link download in: http://tools.android.com/download/studio/canary/latest
thanks #joshgoldeneagle, worked in AS v1.4 for me. also effective in AS is to open "build.gradle (Module.app)" and change version from v7.23.1.1 to v7.23.0.1 -hth
Quick fix
Select a theme with no AtcionBar in UI Preview Tool
You will need to change the api rendering level to 17, there may be rendering problem with higher level apis, might be higher level apis suppose to have a default theme, and hope you are not specified none.
For AS v1.4 adding "Base" before Theme.AppCompat.Light.DarkActionBar in the styles.xml folder solved the problem
Additionally, updating to AS v2.1 also solved the problem. Which is better likely depends on collaborators and their AS version.
In res/values/styles.xml, you will find your AppTheme as below :-
Change it to :-
by adding "Base" the rendering issue will get resolved.
Changing the theme in the manifest solved my problem.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
I'm new to android programming (developing on Android Studio 0.8.11) and I'm having issues applying a custom theme to an ActionBar.
My goal is to create a complete custom actionBar with different colours and resources. My min SDK is 16.
Here is the example theme definition in the /res/values/styles.xml:
<style name="Theme.MyStyle" parent="#android:style/Theme.Holo.Light.DarkActionBar" >
<item name="android:actionMenuTextColor">#00FF00</item>
</style>
I'm trying to applying this to all the app with the following line in the manifest xml:
<application> [...] android:theme="#android:style/Theme.MyStyle">
</application>
However when I try to lookout for "Theme.MyStyle" the auto-completion seems not to find it. In fact that part is reded out and the compiler says "No resource found that matches the given name '#android:style/Theme.MyStyle'" .
I'm just trying to figure out how to correct applying a theme, all the guides found even on android developer makes the theming easy but I can't find what's wrong!
Any tips? Thank you very much!
#android:style is for predefined android styles
Change this
android:theme="#android:style/Theme.MyStyle"
into
android:theme="#style/Theme.MyStyle"
I am getting following error on deploying one of the sample projects given by android: android api demos for api level 8 :
error: Error retrieving parent for item: No resource found that matches the given name 'android:style/Theme.Wallpaper'.
at values/styles.xml line 43
<style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
<item name="android:colorForeground">#fff</item>
</style>
I have been looking for solutions for over a month now. I have tried rebuilding project, dowloading entire source code again and rebuilding and cleaning.
Help
As Very Well Explain by raychenon.
<style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper" >
<item name="android:colorForeground">#fff</item>
</style>
What is happening is that some styles, like Theme.Wallpaper are not public. You should not extend from them anymore.
Some suggest to revert to platform_tools_r05 HERE
If you want to do the correct way read Xavier July 28 HERE
If you wish to reuse a style that is private, you should copy the
content of that style into your own instead of extending it.
ANSWER
Default theme for windows that want to have the user's selected
wallpaper appear behind them.
<style name="Theme.Wallpaper">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:windowShowWallpaper">true</item>
</style>
Looks like you want to use the above code from the Android source and create your own theme based it.
Hope it Will Helps you.
You can refer to this question posted here and read Xavier's comments on the Google blog..
style reference after SDK and ADT plugin update in mid 2011
Hope it helps..Keep me posted
When you import the Android Samples via "Android projects from existing code", I noticed that the libraries and API number are Android 1.5 and API level 3.
This API Level doesn't support android:style/Theme.Wallpaper.
I fixed it by adjusting the Project Build Target to Android 2.2 (API Level 8) in the Project Properties Menu.
I'm attempting to style the ActionBar, following this blog post:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
With this source code:
svn checkout http://styled-action-bar.googlecode.com/svn/trunk/ styled-action-bar-read-only
However, I'm getting issues in /res/values/styles.xml.
This:
<!-- style for the tabs -->
<style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBarView_TabView">
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
</style>
Is erroring with:
Error retrieving parent for item: No resource found that matches the given name 'android:style/Widget.Holo.Light.ActionBarView_TabView'.
However, using the following answer, and digging through the source for Android, I can see that the theme does indeed exist:
https://stackoverflow.com/a/7149389/420001
The only thing that I changed in the project was moving it from android-11 to android-14, and then running an "Android" > "Fix Project Properties" in Eclipse. I do note that the repo linked to in that answer, that lists the style, is on branch master, so I can't see why the theme would be unfound.
Just for tests, I put that chunk of code in my working android-14 targeting app, minus the background drawable, and it throws the same error.
According to the links in https://stackoverflow.com/a/7837756/1003511 there is a Widget_Holo_Light_ActionBar_TabView but not a Widget_Holo_Light_ActionBarView_TabView. It's possible the resource has been renamed since that tutorial was written. It says the version without the extra "view" has been included since API level 13 - if the tutorial was originally written on 11 it's possible it was renamed in 13, and since you are running 14 you can only see the renamed version. I'd try removing the extraneous "view" and see if the code runs.
You may be missing an '#' character when specifying that you want to look in the android styles:
You can also double check to see if the parent style is listed in the API documentation here:
http://developer.android.com/reference/android/R.style.html
It looks like you may have the name slightly wrong.