I am trying to import a library in Android:
compile 'com.materialcontentoverflow:materialcontentoverflow:1.1.0'
But when I try it tells me that:
C:\Users\A\Desktop\Project\app\build\intermediates\exploded-aar\me.drakeet.materialdialog\library\1.2.2\res\values\values.xml
But if I look in that project there is no values with rippleColor. This is the file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/Users/drakeet/AndroidStudioProjects/MaterialDialog/library/src/main/res/values/color.xml -->
<eat-comment/>
<color name="card_background">#ffffff</color>
<color name="card_shadow">#10000000</color>
<color name="lite_blue">#ff359ff2</color>
<color name="window_background">#00000000</color>
<!-- From: file:/Users/drakeet/AndroidStudioProjects/MaterialDialog/library/src/main/res/values/dimens.xml -->
<eat-comment/>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<!-- From: file:/Users/drakeet/AndroidStudioProjects/MaterialDialog/library/src/main/res/values/strings.xml -->
<eat-comment/>
<string name="action_settings">Settings</string>
<string name="app_name">MaterialDialog</string>
<string name="hello_world">Hello world!</string>
The library that I am trying to import has the following as values.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/home/artur/workspaceAndroidStudio/MaterialContentOverflow/materialcontentoverflow/src/main/res/values/colors.xml -->
<eat-comment/>
<color name="shadow_end_color">#android:color/transparent</color>
<color name="shadow_mid_color">#14000000</color>
<color name="shadow_start_color">#44000000</color>
<declare-styleable name="FloatingActionButton"><attr name="android:background"/><attr name="backgroundTint"/><attr name="backgroundTintMode"/><attr format="color|reference" name="rippleColor"/><attr name="fabSize"><enum name="normal" value="0"/><enum name="mini" value="1"/></attr><attr name="elevation"/><attr format="dimension|reference" name="pressedTranslationZ"/></declare-styleable>
<declare-styleable name="MaterialContentOverflow"><attr format="reference" name="buttonDrawable"/><attr format="reference" name="fabButtonColor"/><attr format="reference" name="contentColor"/><attr format="enum" name="buttonPosition"><enum name="left" value="0"/><enum name="center" value="1"/><enum name="right" value="2"/></attr></declare-styleable>
<!-- From: file:/home/artur/workspaceAndroidStudio/MaterialContentOverflow/materialcontentoverflow/src/main/res/values/dimens.xml -->
<eat-comment/>
<dimen name="fab_content_size">24dp</dimen>
<dimen name="fab_elevation">8dp</dimen>
<dimen name="fab_size_mini">40dp</dimen>
<dimen name="fab_size_normal">56dp</dimen>
<dimen name="fab_translation_z_pressed">6dp</dimen>
I can't work out what the problem is?! Can anyone help please?
Checking the source on github
<!-- Ripple color for the FAB. -->
<attr name="rippleColor" format="color|reference" />
This library is using the rippleColor.
You can't use it since it is used by supportlibrary.
You can clone the library changing the attr.
Related
I have an Android app I am trying to build, and I am getting the following error:
Apparently it was unable to compile the values resource file.
I have followed some of the suggestions in this StackOverflow question. I've gone through my strings.xml file and put a backslash before characters like the colon, the exclamation point, the full stop etc. I have looked at the colours and they do appear to be correct:
I have rebuilt several times, and done several cleans. I even restarted Android studio after putting the backslash into my strings.xml. I have tried looking in logs, but I cannot see where the issue is. Is there anything else I need to check?
Contents of resource files are below:
colours.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#c86f22</color>
<color name="BackgroundAccent">#ff424242</color>
</resources>
dimens.xml:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
</resources>
font_certs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>#array/com_google_android_gms_fonts_certs_dev</item>
<item>#array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1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KYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
</item>
</string-array>
</resources>
ic_launcher_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#808080</color>
</resources>
ids.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="CardTicket" type="id">0000001</item>
<item name="tempCard" type="id">0000002</item>
</resources>
preloaded_fonts.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>#font/advent_pro_medium</item>
</array>
</resources>
strings.xml:
<resources>
<string name="app_name">FixITApp</string>
<!-- Strings related to login -->
<string name="prompt_email">Email</string>
<string name="prompt_password">Password (optional)</string>
<string name="action_sign_in">Sign in or register</string>
<string name="action_register">Register</string>
<string name="back">Back</string>
<string name="Sign_in_here">Already have an account\? Sign in here\:</string>
<string name="Register_here">No Account\? Register here for your free account\!</string>
<string name="ExitToMenu">Exit to Main Menu</string>
<string name="Exit_App">Exit Application</string>
<string name="action_sign_in_short">Sign in</string>
<string name="error_invalid_email">This email address is invalid</string>
<string name="error_invalid_password">This password is too short</string>
<string name="error_incorrect_password">This password is incorrect</string>
<string name="error_field_required">This field is required</string>
<string name="permission_rationale">"Contacts permissions are needed for providing email
completions\."
</string>
<string-array name="IssueTypes">
<item> </item>
<item>Please Select a value\:</item>
<item>PC</item>
<item>Server</item>
<item>Laptop</item>
<item>Monitor</item>
<item>Keyboard</item>
<item>Mouse</item>
<item>RAM</item>
<item>HardDrive</item>
<item>Projector</item>
<item>Interactive Board</item>
<item>Other</item>
</string-array>
<string-array name="Severities">
<item> </item>
<item>Please Select a value\:</item>
<item>Critical</item>
<item>High</item>
<item>Moderate</item>
<item>Low</item>
</string-array>
</resources>
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.PopUpTing">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
</resources>
OK, so I got it working.
The problem was in ids.xml, which contained the following:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="CardTicket" type="id">0000001</item>
<item name="tempCard" type="id">0000002</item>
</resources>
I ran the build again using --scan, and learnt that <item> inner element must either be a resource reference or empty. I removed the 0000001 and 000002 from the IDs and it is now building.
Is it possible to deprecate a custom attribute?
Example:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MyCustomView">
<!-- {#deprecated Use foobar instead.} -->
<attr name="my_title" format="string"/>
<attr name="title_text_size" format="dimension"/>
</declare-styleable>
</resources>
This doesn't seem to work.
Regards,
Scott.
I'm trying to develop two themes for my app, and depending on the theme, I need a View to use a different selector. Though when I create a reference which determines the correct selector to use, I get an InflationException error.
Here's my attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ReditrTheme">
<attr name="downvoteArrow" format="reference" />
<attr name="upvoteArrow" format="reference" />
</declare-styleable>
<declare-styleable name="VoteState">
<attr name="enabled" format="boolean" />
</declare-styleable>
</resources>
Here's my themes.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="DarkTheme" parent="#android:style/Theme.Holo">
<item name="upvoteArrow">#drawable/upvote_states</item>
<item name="downvoteArrow">#drawable/downvote_states</item>
</style>
<style name="LightTheme" parent="#android:style/Theme.Holo.Light">
<item name="upvoteArrow">#drawable/upvote_states_l</item>
<item name="downvoteArrow">#drawable/downvote_states_l</item>
</style>
</resources>
Here's my upvote_states.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.reditr.app">
<item android:drawable="#drawable/ic_action_arrow_top_colored" app:enabled="true"/>
<item style="#drawable/ic_action_arrow_top" app:enabled="false"/>
</selector>
Here's my upvotes_states_l.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.reditr.app">
<item android:drawable="#drawable/ic_action_arrow_top_colored" app:enabled="true"/>
<item style="#drawable/ic_action_arrow_top_l" app:enabled="false"/>
</selector>
downvotes_states.xml and downvotes_states_l.xml are identical to the ones above, they just use ic_action_arrow_bottom instead.
Finally, here's my View that I'm trying to apply the reference to:
<com.example.views.UpvoteView
android:id="#+id/upvote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:scaleType="fitCenter"
android:src="?attr/upvoteArrow" />
I tried a few solutions online but they were always a bit slightly different to my issue and didn't fix my problem.
Thanks in advance!
Just realized the mistake I made. In my states.xml files, I used the style attribute for some reason, it should have been android:drawable.
Please help me, error at declare-styleable tag: No found tag
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<declare-styleable name=”Gallery1”>
<attr name=”android:galleryItemBackground” />
</declare-styleable>
</resources>
You are using ” instead of ". Try the following:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<declare-styleable name="Gallery1">
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
I want to separate the usage of my application on xlarge devices and usage on other devices to restrict layout_width parameter by 720dp for xlarge. For this purpose I create values/attrs.xml:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<attr name="layoutWidth" format="reference|dimension" />
</resources>
with custom parameter layoutWidth to set it in
android:layout_width="?layoutWidth"
Furtner, I need to specify two themes.xml files for xlarge and ordinary devices in values-xlarge and values directories:
values-xlarge/themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme" parent="android:Theme">
<item name="layoutWidth">720dp</item>
</style>
</resources>
values/themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme" parent="android:Theme">
<item name="layoutWidth">What should I write here!?</item>
</style>
</resources>
So, how can I make a reference on Android "fill_parent" parameter at this place? It seems like #android:layout_width/fill_parent, but I have compiling Error:
No resource found that matches the given name (at 'layoutWidth' with value '#android:layout_width/fill_parent').
I have found a solution by means of changing values/attrs.xml to:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<attr name="layoutWidth" format="dimension">
<enum name="fill_parent" value="-1" />
<enum name="match_parent" value="-1" />
<enum name="wrap_content" value="-2" />
</attr>
</resources>
Now, I can write in values/themes.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme" parent="android:Theme">
<item name="layoutWidth">match_parent</item>
</style>
<resources>
But the question still remain: Is it possible to refer to Android layout_width parameter from this place?
You should create attrs.xml file inside values folder and then add the below code in it:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="custom_match_parent" type="dimen">-1</item>
<item name="custom_wrap_content" type="dimen">-2</item>
</resources>
To access the above created attrs.xml add the below line inside your dimens.xml file as follows:
<dimen name="max_layout_width">#dimen/custom_match_parent</dimen>
Now to access that from a layout file you must do something like
<FrameLayout
android:layout_width="#dimen/max_layout_width"
android:layout_height="match_parent">
<!--Do what you like to do here-->
</FrameLayout>
Hope this helps! :-)
Well, this is a late response...but, for posterity and sanity, the answer can be found below and more info can be found at http://developer.android.com/guide/topics/ui/themes.html
styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="YourStyle" parent="#android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources>
This should work for any parent style that uses android:layout_width, such as parent="#android:style/Widget.TextView"
Not sure if you can add this attribute somewhere in your resources or style tags, but it may help (if its legal)
xmlns:android="http://schemas.android.com/apk/res/android"
This specifies the namespace where layout_width and layout_height are defined (as well as the constants fill_parent and wrap_content).