Rendering error in Android studio 1.5? - android

I am new to Android and recently installed Android Studio 1.5. However I'm getting Some problems in Rendering
Rendering problem in Android Studio 1.5
I've tried installing packages and here are those
SDK Tools
I searched forums for help and found some answers. I then selected a lower version of Android API(Android 5.0 instead of Android 6.0). I also tried changing the Theme(Tried Theme.AppCompat, Holo.Light, Material.Light). Then I also edited my styles.xml file in this way
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
instead of
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
I tried every method I found on the Internet, but nothing helped.
The main problem is that I cant See the design interface (or UI, or simply the phone screen) and even if I see it by changing some Settings, I cant add widgets to it and edit the Layout. For example, I cant select the Hello World in default blank activity and delete it.
Friends I am new to Android Development and a very beginner

I changed the android version to use to automatically pick best fit.
It is circled a with blue ink and marked "x" in the image.
This resolved the issue for me.

the first answer works for me on android studio 1.5
ERROR :rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout
open styles.xml ( app --> res --> values --> styles.xml )
remove existing code in <style> tag
insert only this code <style name="AppTheme"
parent="Base.Theme.AppCompat.Light.DarkActionBar"/>

Related

Migrating from material 2 to 3 causing issues. Changing theme causes app to crash

I am new to android app development and am trying to develop using material 3 UI. However, as soon as I am chaning the base theme, I run the app, and on Android Studio it shows that it launches but then the app crashes as soon as it launches. Would really appreciate some help regarding this!
I tried to change the base theme and add several items under it but that did not work. I also tried different versions of Materia3 Base themes but not working
I went to themes.xml and added the following code to change the base theme
<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar">
<!-- ... -->
</style>
as per this documentation
https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md

Which themes.xml file should we use instead of style.xml in android

In my android studio, there is no style.xml file.
There is a themes folder having two themes.xml files.
Please tell which themes.xml file should we use for android tab functionality.
It got changed in Android studio 4.1
Actually, in the older versions of Android studio, if you want to enable dark mode in your app, you have to manually create and define the properties in your dark theme XML file, but now it is automatically generated as mostly all new apps are moving towards dark mode in their applications.
You can still delete these files from your Android studio project if it doesn't fit in your use-case.
There are two themes.xml in the new Android Studio project templates.
One is for a light theme and the other one is for a dark theme.
More info on dark theme
Implementing a dark theme (or black theme) is very easy today thanks to
Theme.DayNight and
AppCompatDelegate
Android comes to us allowing us to declare
night/colors.xml
and
night/styles.xml
Full example here: https://github.com/android/user-interface-samples/tree/master/DarkTheme

What is a theme and how do I know if I have the "correct" one?

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.

Error while deploying sample code by android, project:android api demos

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.

how to make gui elements like a button on every device look like the native gui in android?

hi i have a question about the gui of a android application.
when i start a project and select 2.3.3 as my api version. i add some gui stuff like a button and then run the code on a 4.0.3 device.
the problem is now: the button looks like a 2.3.3 button and not like the 4.0.3 version.
is there any way to change this?
You have to use one of the Holo themes for API Level 11+:
Create res/values folder
Define your application theme like this:
<style name="AppTheme" parent="#android:style/Theme" />
Create res/values-v11 folder
Define your application theme like this:
<style name="AppTheme" parent="#android:style/Theme.Holo.Light" />
Use AppTheme in AndroidManifest.xml
For further reading, see section Using Holo while supporting Android 2.x in this article.
And if you want Holo for 2.3.3 applications I can recommend this project. Just follow the instructions on the site on how to use it.

Categories

Resources