I am using eclipse for one old existing android app. app was previously using actionBarSherlock, I switch to AppCompat this project.. added AppCompat support v7 project as library . so related to AppCompat Java imports are resolved , but in style.xml it is giving problem .. for eg.
<style name="customActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">#color/darkblue</item>
<item name="background">#color/darkblue</item>
</style>
here this parent name is not resolved.. please guide me on this.
Thanks in advance.
At first,clean your project and rebuild it. If doesn't work, remove your support v7 library and do first step again.
Related
I'm trying to make an Android app through Xamarin. I work on Windows 10 with VS2015.
I have to implement a side bar menu. After some research I found a solution to do it : use a DrawerLayout and others tools. That's why I use Theme.AppCompat in my application.
But when I'm trying to make a style which herits from Theme.Appcompat.light.NoActionBar, I got compile issue. The message is :
Error retrieving parent for item: No resource found that matches the given name '#android:style/Theme.AppCompat.Light.NoActionBar'.
I've added Xamarin.Android.Support.v4 and Xamarin.Android.Support.v7.AppCompat references to my project as bellow :
Project References
Edit: I also tried to add them by xamarin Component and nuget package manager.
But nothing compile.
Here is the code which produce this error:
<resources>
<style name="DailyCoin.HomeTheme" parent="#android:style/Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#219653</item>
<item name="drawerArrowStyle">#style/MyDrawerArrowStyle</item>
</style>
<style name="MyDrawerArrowStyle" parent="#android:style/Widget.AppCompat.DrawerArrowToggle">
<item name="color">#F5F5F5</item>
<item name="spinBars">true</item>
</style>
</resources>
minSdkVersion is 17 and compile using version is 23
Ok, I found the solution.
My problem was that xamarin was corrupted and the component adding module had some troubles when i added components. So i removed all references/components i've added to my projet, reinstalled xamarin.
Just for people impatient like me:
Then i had a new issue : "Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r28.zip" because when generated the solution, it took a lot of time and i stoped this.
The solution was to delete all zips in "%localappdata%/xamarin/zips" and wait for the generation.
Thank for your help !
Julien
Did you try this?
parent="Theme.AppCompat.Light.NoActionBar"
Check this out (its working for me): Navigation Drawer using material design
Leave out #android:style/ so just:
parent="Theme.AppCompat.Light.NoActionBar"
I have an Android project using another one as library. So far I've been working on Eclipse with Maven, now I want to migrate to Android Studio and Gradle.
The problem is that I use to do the following in Eclipse:
Library project:
<style name="some_theme">
<item name="android:textColor">#00FF00</item>
</style>
And then in my main project:
<style name="some_theme">
<item name="android:typeface">monospace</item>
</style>
So, if the theme name is the same in Eclipse I get whats been defined in both themes, but in Android studio I only get what's on the main project
Has someone encounter this type of issue before? Does someone know a way to solve it? (Other than just copy all what's on the library project...)
Regards
Jose
That shouldn't work. When you define two styles with the same name in two different places, you should run into a naming conflict. There is no documented style resource merging feature. The fact that it works in Eclipse with ADT is probably accidental.
The correct way to do this is to define one style in your library, and inherit from that style in your application.
For example, in your library project:
<style name="SomeThemeBase">
<item name="android:textColor">#00FF00</item>
</style>
Then in your application project:
<style name="AppTheme" parent="SomeThemeBase">
<item name="android:typeface">monospace</item>
</style>
This way you do not create a naming conflict, but your app's theme still inherits the properties you defined on the base theme.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColorPrimary">#color/colorTextPrimary</item>
<item name="android:textColorSecondary">#color/colorTextSecondary</item>
</style>
This is the styles.xml file. The following code results in this error - i have put all the necessary libraries and jar files and i have also tried changing the syntax little bit and many stuff but I am not able to solve the problem. It is very important. Please help me. Thank you.
I have tried the following :
You need to reference this AppCompat library in your Android project.
Import the library into Eclipse.
Right click on your Android project.
Select properties.
Click 'add...' at the bottom to add a library.
Select the support library
Clean and rebuild your project.
It still doesn't work.
Edit now :
I have installed android sdk 5.0 (API 21) but it still doesn't work. The line with the error is
There were 3 other errors before installing android sdk 5.0 (API 21) in this file (styles.xml) but now they are gone. Please help me to remove the remaining error.
If you are using material in the manifest, you will get this error if your min version isn't API 21
Is there any way to create an app with Material design in Eclipse? Hamburger to arrow animation, full screen height navigation drawer...
Yes you can create an app with material design using eclipse.
Please follow each steps below carefully without any error.
Steps:
Create a new Android Project with Target SDK version 21. If your project already exists then just change the Target SDK version.
Add Appcompat v7 lib to your workspace and add this lib to build path of your project. You can find this lib at sdk\extras\android\support\v7.
Set Project build target to version 21.
There should be only 2 values folder in res folder.
values
values-v21
values/styles.xml should be as below.
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
....
// Your style here
</style>
values-v21/style.xml should be as below.
<style name="AppBaseTheme" parent="#android:style/Theme.Material.Light.DarkActionBar">
....
// Your style here
</style>
You can find different style attributes here https://developer.android.com/training/material/theme.html
After following above steps, your app will be ready with material design theme.
Now your second question regarding navigation drawer you can use following link for simple and step by step implementation.
Part 1 http://www.android4devs.com/2014/12/how-to-make-material-design-navigation-drawer.html4
Part 2 http://www.android4devs.com/2015/01/recycler-view-handling-onitemtouch-for.html
This implementation uses recycler view. For that you need to add recycler view lib (location - sdk\extras\android\support\v7) to your project and add it to build path.
You can develop apps with Material Design in Eclipse by using the libraries provided by google. You need to follow the below steps to do that.
Properties> Android> Add...>appcompat_v7
Add...> Android Design Support Library(You can import it from android-sdk\extras\android\support\)
Add...> RecycleViewLibrary & CardViewLibrary libraries for RecycleView and cardView, better material look and feel. (You can import it from android-sdk\extras\android\support\v7\)
Add/Edit values\styles.xml
<style name="MyMaterialTheme.Base" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
Change theme in AndroidManifest.xml file. android:theme="#style/MyMaterialTheme"
extend your Activity by AppCompatActivity.
Hope you can develop Material Designed apps in Eclipse throgh these steps.
Important: Support for the Android Developer Tools (ADT) in Eclipse is ending. You should migrate your app development projects to Android Studio as soon as possible.
Hi I trying chrome cast device with Google's https://github.com/googlecast/CastVideos-android this sample. I have imported appcompat and mediarouter from V7 lib. I also imported google play service lib and CastCompanionLibrary-android. All libs are proper and without any error. But when I tried to build video sample it gives me some resources error in styles-castvideo.xml. It gives error for following resources
<style name="ShowcaseView">
<item name="sv_titleTextAppearance">#style/TextAppearance.ShowcaseView.Title</item>
<item name="sv_detailTextAppearance">#style/TextAppearance.ShowcaseView.Detail</item>
<item name="sv_backgroundColor">#CC000000</item>
<item name="sv_buttonText">#string/ok</item>
<item name="sv_showcaseColor">#color/yellow</item>
</style>
Am I missing something. Need some help. Thank you.
ShowcaseView should be added as library.
https://github.com/naddaf/ShowcaseView
Dependencies
CastCompanionLibrary-android: can be downloaded here at https://github.com/googlecast/CastCompanionLibrary-android
ShowcaseView (see change list 1.1 -> 1.2 for details)