creating Navigation Drawer in android xamarin - android

I am trying to make a Navigation Drawer in android but I get this error:
1.No resource found that matches the given name: attr 'colorPrimary'.
2.No resource found that matches the given name: attr 'colorPrimaryDark'.
3.No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'
and here is my code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.DesignDemo" parent="Base.Theme.DesignDemo"></style>
<style name="Base.Theme.DesignDemo" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#2196F3</item>
<item name="colorPrimaryDark">#1976D2</item>
</style>
</resources>

Add Xamarin Support v4 and v7 AppCompat NuGet packages to your project.

Try this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.DesignDemo" parent="Base.Theme.DesignDemo"></style>
<style name="Base.Theme.DesignDemo" parent="#android:style/Theme.AppCompat.Light.NoActionBar">
<item name="android:colorPrimary">#2196F3</item>
<item name="android:colorPrimaryDark">#1976D2</item>
</style>
</resources>

Related

AAPT: error: expected color reference but got (raw string) null

I needed to hide the default overflow icon (3 dots) so I wrote the code below. I was working fine until I updated android studio yesterday, after that its giving me this error:
D:\Android Projects\myapp\app\src\main\res\values\styles.xml:18:5-21:13: AAPT: error: expected color reference but got (raw string) null.
Here's the code:
<style name="MaterialTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">#color/primaryColor</item>
<item name="colorPrimaryDark">#color/primaryDarkColor</item>
<item name="colorAccent">#color/secondaryColor</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:actionOverflowButtonStyle">#style/CustomActionOverflowButtonStyle</item>
</style>
<style name="CustomActionOverflowButtonStyle">
<item name="android:width">8dp</item>
<item name="android:src">null</item>
</style>
What am I doing wrong? Please help!
change this
<item name="android:src">null</item>
to
<item name="android:src">#null</item>

Android : error: failed linking references

Am getting error while trying to build the application.
Android resource linking failed
error: resource style/Base.V28.Theme.AppCompat.Light (aka
com.xxx.xxxx/Base.V28.Theme.AppCompat.Light) not found.
error: failed linking references.
build.gradle
compileSdkVersion 28
also in sdk manager platform tools for 28 is installed
but am not getting the cause of this issue
style.xml
**<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/card_bg</item>
<item name="colorAccent">#color/black_dim</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowAnimationStyle">#null</item>
<item name="autoCompleteTextViewStyle">#style/cursorColor</item>
</style>
<style name="AppThemeChange" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
</style>
<style name="MyTabLayoutTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse">
<item name="android:textSize">#dimen/tab_text_size</item>
<item name="android:textAllCaps">true</item>
</style>
I am new in coding of any kind, but I have just fixed this error by following a solution in another StackOverflow thread that says to do the following:
Give in the command
gradlew.bat --info clean build
I gave this command into the end of my build.gradle file and it showed me AS WELL as fixed the error!
I'm so happy! This command should be the answer to many problems!

Error: No resource found that matches the given name: attr

I have an Xamarin.Forms app that fails to build for Android on my Mac (same on Windows) while it did work fine before (not sure what changed in the meantime). The same projects builds fine on the pc of a colleague.
It's a Xamarin.Forms app using PCL. I get the following errors in my styles.xml file:
Resources/values/styles.xml(3): error APT0000: Error: No resource found that matches the given name: attr 'colorAccent'.
Resources/values/styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'colorPrimary'.
Resources/values/styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
Resources/values/styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'windowActionBar'.
Resources/values/styles.xml(4): error APT0000: Error: No resource found that matches the given name: attr 'windowActionModeOverlay'.
Resources/values/styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'windowNoTitle'.
This is what my styles.xml looks like:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme.Splash" parent ="android:Theme.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleSize">0dp</item>
<item name="android:windowBackground">#drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="android:Theme.Light">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#2196F3</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1976D2</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#FF4081</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
</style>
</resources>
I can't figure out why it works for on my colleagues pc and not on mine. I've even tried installing ALL Android SDKs and other tools without any success.
I don't know how to continue. Any help is appreciated.

Unable to compile Android app with Sherloc theme

Sorry to trouble i have been trying to fix these issues for the past 2 weeks anything you want to see i can post please help me solve this
I am using Eclipse not android studio here with also my style.xml
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.App">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="title_text_style" parent="android:Widget.TextView">
<item name="android:gravity">center</item>
<item name="android:padding">5dp</item>
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
<item name="android:textColor">#color/white</item>
</style>
<style name="title_bg">
<item name="android:background">#color/light_green</item>
<item name="android:gravity">center</item>
<item name="android:orientation">vertical</item>
</style>
<style name="editext_register_style" parent="android:Widget.EditText">
<item name="android:background">#drawable/edit_bar_bg_register_big</item>
<item name="android:gravity">center_vertical</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:paddingLeft">3dp</item>
<item name="android:textColor">#color/white</item>
<item name="android:textColorHint">#color/white</item>
</style>
<style name="tv_chat_menu_style" parent="android:Widget.Holo.Light.TextView">
<item name="android:gravity">center_horizontal</item>
<item name="android:layout_margin">3dp</item>
<item name="android:textColor">#color/light_green</item>
</style>
<style name="Theme.App" parent="Theme.Sherlock.Light">
<item name="actionBarStyle">#style/Theme.App.ActionBar</item>
</style>
<style name="Theme.App.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="displayOptions">showHome|useLogo</item>
</style>
And this below is the errors i am getting when building
Description Resource Path Location Type
error: Error: No resource found that matches the given name: attr 'actionBarStyle'. styles.xml /Shooteka/res/values-v11 line 7 Android AAPT Problem
error: Error: No resource found that matches the given name: attr 'displayOptions'. styles.xml /Shooteka/res/values-v14 line 12 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light'. styles.xml /Shooteka/res/values line 48 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Widget.Sherlock.ActionBar'. styles.xml /Shooteka/res/values-v14 line 10 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light'. styles.xml /Shooteka/res/values-v11 line 5 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Widget.Sherlock.ActionBar'. styles.xml /Shooteka/res/values line 52 Android AAPT Problem
error: Error: No resource found that matches the given name: attr 'displayOptions'. styles.xml /Shooteka/res/values line 53 Android AAPT Problem
error: Error: No resource found that matches the given name: attr 'actionBarStyle'. styles.xml /Shooteka/res/values line 49 Android AAPT Problem
error: Error: No resource found that matches the given name: attr 'actionBarStyle'. styles.xml /Shooteka/res/values-v14 line 7 Android AAPT Problem
error: Error: No resource found that matches the given name: attr 'displayOptions'. styles.xml /Shooteka/res/values-v11 line 12 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light'. styles.xml /Shooteka/res/values-v14 line 5 Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Widget.Sherlock.ActionBar'. styles.xml /Shooteka/res/values-v11 line 10 Android AAPT Problem
Description Resource Path Location Type
The project was not built due to "A resource exists with a different case: '/Shooteka/bin/classes/com/chat'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent Shooteka Unknown Java Problem

Android Custom Alert Dialog Error after updating android sdk r12

I got the following error after updating my android sdk revision to r12.
error: Error retrieving parent for item: No resource found that matches the given name '#android:style/AlertDialog'.
Here is my xml file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomDialogTheme" parent="#android:style/AlertDialog">
<item name="android:windowFrame">#null</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowAnimationStyle">#android:style/Theme.Dialog</item>
</style>
</resources>
I didn't change anything in the code and the only thing that I did was upgraded the Android SDK.
android:style/AlertDialog is not a public style and you should not use it. Please refer to this thread How to change theme for AlertDialog
Finaly i found the answer . i know its not the proper way but it works for now.
I managed to fix it by replacing the platform-tools_r06 with platform-
tools_r05 in android sdk folder
you can dowload platform-tools-r05 from here.

Categories

Resources