Android Resource Linking Failed on Apk Build - java

Goodday, I am getting this error when i decide to build my android app on Android Studio. Please how do i fix
C:\Users\HP-PC.gradle\caches\transforms-2\files-2.1\dc1436142102318e0c7f87330e8cc57a\jetified-pinpad-1.0.1\res\values\values.xml:7:5-161: AAPT: error: resource attr/foreground (aka com.cptvstudio.tv:attr/foreground) not found.
C:\Users\HP-PC.gradle\caches\transforms-2\files-2.1\dc1436142102318e0c7f87330e8cc57a\jetified-pinpad-1.0.1\res\values\values.xml:7:5-161: AAPT: error: resource attr/foregroundGravity (aka com.cptvstudio.tv:attr/foregroundGravity) not found.
I do not know where the error might be coming from. Below is my values.xml code if it might help
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="pstck_pinpad_default_button_textcolor">#DFE1E2</color>
<color name="pstck_pinpad_default_pin_indicator_empty_color">#E0E0E0</color>
<color name="pstck_pinpad_default_pin_indicator_filled_color">#C4C4C4</color>
<color name="pstck_pinpad_default_prompt_textcolor">#D0D0D0</color>
<declare-styleable name="ForegroundView"><attr name="foreground"/><attr name="foregroundInsidePadding"/><attr name="foregroundGravity"/></declare-styleable>
<declare-styleable name="PinPadView"><attr format="boolean" name="place_digits_randomly"/><attr format="boolean" name="auto_submit"/><attr format="boolean" name="vibrate_on_incomplete_submit"/><attr format="color" name="pin_indicator_filled_color"/><attr format="color" name="pin_indicator_empty_color"/><attr format="dimension" name="pin_indicator_size"/><attr format="dimension" name="pin_indicator_stroke_width"/><attr format="dimension" name="pin_indicator_spacing"/><attr format="integer" name="pin_length"/><attr format="string" name="prompt_text"/><attr format="color" name="prompt_textcolor"/><attr format="dimension" name="prompt_textsize"/><attr format="dimension" name="prompt_text_padding"/><attr format="dimension" name="prompt_text_paddingTop"/><attr format="dimension" name="prompt_text_paddingBottom"/><attr format="color" name="button_textcolor"/><attr format="dimension" name="button_numeric_textsize"/><attr format="dimension" name="button_alpha_textsize"/><attr format="string" name="button_text_numeric"/><attr format="string" name="button_text_alpha"/><attr format="reference" name="button_drawable"/><attr format="dimension" name="button_drawable_size"/></declare-styleable>
<dimen name="pstck_pinpad__default_indicator_height">64dp</dimen>
<dimen name="pstck_pinpad__default_prompt_padding">24dp</dimen>
<dimen name="pstck_pinpad__default_prompt_paddingBottom">16dp</dimen>
<dimen name="pstck_pinpad__default_prompt_paddingTop">16dp</dimen>
<string name="pstck_pinpad__app_name">pinpad</string>
<string name="pstck_pinpad__num_0">0</string>
<string name="pstck_pinpad__num_1">1</string>
<string name="pstck_pinpad__num_2">2</string>
<string name="pstck_pinpad__num_3">3</string>
<string name="pstck_pinpad__num_4">4</string>
<string name="pstck_pinpad__num_5">5</string>
<string name="pstck_pinpad__num_6">6</string>
<string name="pstck_pinpad__num_7">7</string>
<string name="pstck_pinpad__num_8">8</string>
<string name="pstck_pinpad__num_9">9</string>
<style name="Widget"/>
<style name="Widget.PinPad">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="button_textcolor">#color/pstck_pinpad_default_button_textcolor</item>
<item name="prompt_textcolor">#color/pstck_pinpad_default_prompt_textcolor</item>
<item name="pin_indicator_filled_color">#color/pstck_pinpad_default_pin_indicator_filled_color</item>
<item name="pin_indicator_empty_color">#color/pstck_pinpad_default_pin_indicator_empty_color</item>
<item name="android:gravity">center</item>
</style>
</resources>

check your attr file again <attr name="foreground"/> and <attr name="foregroundGravity"/> not defined in attr file

Related

What is the different uses of attrs in android?

First of all, i know that there plenty of post about the issue and i think i read them all. If someone ask i will attach them for approve :)
I have an issue with attrs. The issue is that sometimes i see programmers using it when they create a custom view but sometimes i see that they are used also when building a theme.
For example:
<declare-styleable name="Main_Theme">
<attr name="background" format="reference" />
<attr name="backgroundCard" format="reference" />
<attr name="secondaryTextColor" format="reference" />
<attr name="primaryTextColor" format="reference" />
<attr name="primaryColor" format="reference" />
<attr name="secondaryColor1" format="reference" />
<attr name="secondaryColor2" format="reference" />
<attr name="secondaryColor3" format="reference" />
<attr name="dividerColor" format="reference" />
and then they creates a theme using it.
For example:
<item name="background">#color/dark_theme_background</item>
<item name="backgroundCard">#color/dark_theme_card_background</item>
<item name="secondaryTextColor">#color/dark_theme_scores_new</item>
<item name="primaryTextColor">#color/dark_theme_primary_text_color</item>
<item name="primaryColor">#color/dark_theme_primary_color</item>
<item name="secondaryColor1">#color/dark_theme_secondary_1_color</item>
<item name="secondaryColor2">#color/dark_theme_secondary_2_color</item>
<item name="secondaryColor3">#color/dark_theme_secondary_3_color</item>
<item name="dividerColor">#color/dark_theme_divider_color</item>
Then i saw them using those items as values for attributes in layout activity xml file
So i really can't understand the variety use of attrs.
I hope someone can help me to understand cause i feeling very confused
attr is used when make custom view with custom attribute.
If you define attr, you can use it in xml file.
Normal View use default attribute such as width, height, background, text etc.
So you can use it in xml file.
<TextView
android:width="match_parent"
android:height="wrap_content"
android:background="#color/white"
android:text="#string/app_name" />
But there is no attribute for your custom view.
If your custom view needs dividerColor attribute, you can't use it android:dividerColor as following.
<YourCustomView
android:width="match_parent"
android:height="wrap_content"
android:background="#color/white"
android:dividerColor="#color/black" /> // it caused compile error.
So you need your attribute for use in xml file.
For it, you need declare attrs in attrs.xml file. (xml file name can change.)
<declare-styleable name="Main_Theme">
<attr name="dividerColor" format="reference" />
</declare-styleable>
And then you can use new attribute in view xml file.
<YourCustomView
xmlns:app="http://schemas.android.com/apk/res-auto" // need define app
android:width="match_parent"
android:height="wrap_content"
android:background="#color/white"
app:dividerColor="#color/black" /> // it's works
PS: You need to additional code for use custom attr in YourCustomView class file.
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.Main_Theme);
dividerColor = ta.getColor(R.styleable.MainTheme_divider_color, Color.WHITE);
Attr represents an attribute in an element. Simply put attrs are allowable quantities that are defined in a schema associated with a document.
Whenever we create a custom view we don't want the view to accept every possible value under the sky, so we define a few values that can be accepted by the view using the attr interface. these attributes are defined using declare-stylable that enables you to define attributes for custom views.for example:
<resources>
<declare-styleable name="PieChart">
<attr name="showText" format="boolean" />
<attr name="labelPosition" format="enum">
<enum name="left" value="0"/>
<enum name="right" value="1"/>
</attr>
</declare-styleable>
</resources>
this custom view accepts showText and label attributes. the showText accepts a boolean value and the labelPosition accepts values: left and right. like the example below
<PieChart
showText="false"
labelPosition="left"/>
similarly in themes we need to define certain attributes that can be used inside the theme for example if we create 2 themes and want to define a different primary color that will be used by the app when using either theme. we first declare the color attr like so in the attrs.xml:
<declare-styleable name="Main_Theme">
<attr name="color_primary" format="color" />
</declare-stylable>
and then inside the styles.xml we define the values for the color_primary attr for the 2 themes
<style name="theme_one">
<item name="color_primary">#ff0000</item> // red
</style>
<style name="theme_two">
<item name="color_primary">#00ff00</item> // green
</style>
this value could then be used in layout files like so: ?attr/color_primary
similarly attr could be used to define a wide range of things. an attr element itself has 2 attributes the name with which you refer it in other parts of the code and the format which could be color, boolean, dimension, float etc. for example enums could be defined as:
<attr name="some_enum_attr">
<enum name="value_one" value="1" />
<enum name="value_two" value="2" />
</attr>

Error:(144) Attribute "srcCompat" has already been defined

I've coded an application which can post tweets and you can see user timelines and search timelines with it. I did that with the TwitterAPI and fabric.io. And if I want to generate an APK file or sync the Gradle file, I get these errors:
C:\Users\Alexander\AndroidStudioProjects\FacebookPlus\app\build\intermediates\res\merged\debug\values\values.xml
Error:(140) Attribute "srcCompat" has already been defined
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Alexander\AppData\Local\Android\sdk1\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
I had the same problem but I found a workable solution. Here's the link. Hopefully it sorts you out...
app:srcCompat is an xml attribute usually applied to views like ImageView.
Maybe you declared that attribute twice in the same view.
Answer for Alan_UK's request - I cant post the full content because it is too long. I only post the content which includes the dual attributes
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="http://schemas.android.com/tools">
<attr format="reference" name="backgroundCompat"/>
<attr format="reference|color" name="dgts__accentColor"/>
<attr format="reference" name="dgts__logoDrawable"/>
<attr format="reference" name="drawerArrowStyle"/>
<attr format="dimension" name="height"/>
<attr format="boolean" name="isInScrollContainer"/>
<attr format="boolean" name="isLightTheme"/>
<attr format="reference" name="srcCompat"/>
<attr format="string" name="title"/>
<attr format="reference" name="tw__twitter_logo"/>
<bool name="abc_action_bar_embed_tabs">true</bool>
<bool name="abc_action_bar_embed_tabs_pre_jb">false</bool>
<bool name="abc_action_bar_expanded_action_views_exclusive">true</bool>
<bool name="abc_allow_stacked_button_bar">true</bool>
<bool name="abc_config_actionMenuItemAllCaps">true</bool>
<bool name="abc_config_allowActionMenuItemTextWithIcon">false</bool>
<bool name="abc_config_closeDialogWhenTouchOutside">true</bool>
<bool name="abc_config_showMenuShortcutsWhenKeyboardPresent">false</bool>
<color name="abc_input_method_navigation_guard">#android:color/black</color>
<color name="abc_search_url_text_normal">#7fa87f</color>
<color name="abc_search_url_text_pressed">#android:color/black</color>
<color name="abc_search_url_text_selected">#android:color/black</color>
<color name="accent_material_dark">#color/material_deep_teal_200</color>
<color name="accent_material_light">#color/material_deep_teal_500</color>
<color name="background_floating_material_dark">#color/material_grey_800</color>
<color name="background_floating_material_light">#android:color/white</color>
<color name="background_material_dark">#color/material_grey_850</color>
<color name="background_material_light">#color/material_grey_50</color>
<color name="bright_foreground_disabled_material_dark">#80ffffff</color>
<color name="bright_foreground_disabled_material_light">#80000000</color>
<color name="bright_foreground_inverse_material_dark">#color/bright_foreground_material_light</color>
<color name="bright_foreground_inverse_material_light">#color/bright_foreground_material_dark</color>
<color name="bright_foreground_material_dark">#android:color/white</color>
<color name="bright_foreground_material_light">#android:color/black</color>
<color name="button_material_dark">#ff5a595b</color>
<color name="button_material_light">#ffd6d7d7</color>
<color name="colorAccent">#e99224</color>
<color name="colorAccentDark">#004676</color>
<color name="colorPrimary">#25c7ac</color>
<color name="colorPrimaryDark">#1d9f8a</color>
<color name="colorfb">#32588e</color>
<color name="design_fab_shadow_end_color">#android:color/transparent</color>
<color name="design_fab_shadow_mid_color">#14000000</color>
<color name="design_fab_shadow_start_color">#44000000</color>
<color name="design_fab_stroke_end_inner_color">#0A000000</color>
<color name="design_fab_stroke_end_outer_color">#0F000000</color>
<color name="design_fab_stroke_top_inner_color">#1AFFFFFF</color>
<color name="design_fab_stroke_top_outer_color">#2EFFFFFF</color>
<color name="design_snackbar_background_color">#323232</color>
<color name="design_textinput_error_color_dark">#FFFF6E6E</color>
<color name="design_textinput_error_color_light">#FFD50000</color>
<color name="dgts__default_accent">#5baaf4</color>
<color name="dgts__default_logo_name">#56626d</color>
<color name="dgts__purple">#744eaa</color>
<color name="dgts__purple_pressed">#553788</color>
<color name="dgts__text_dark">#ff030303</color>
<color name="dgts__text_light">#ffffff</color>
<color name="dim_foreground_disabled_material_dark">#80bebebe</color>
<color name="dim_foreground_disabled_material_light">#80323232</color>
<color name="dim_foreground_material_dark">#ffbebebe</color>
<color name="dim_foreground_material_light">#ff323232</color>
<color name="disabled">#d1d1d1</color>
<color name="error">#ff2424</color>
<color name="foreground_material_dark">#android:color/white</color>
<color name="foreground_material_light">#android:color/black</color>
<color name="grey">#9e9e9e</color>
<color name="highlighted_text_material_dark">#6680cbc4</color>
<color name="highlighted_text_material_light">#66009688</color>
<color name="hint_foreground_material_dark">#color/bright_foreground_disabled_material_dark</color>
<color name="hint_foreground_material_light">#color/bright_foreground_disabled_material_light</color>
<color name="material_blue_grey_800">#ff37474f</color>
<color name="material_blue_grey_900">#ff263238</color>
<color name="material_blue_grey_950">#ff21272b</color>
<color name="material_deep_teal_200">#ff80cbc4</color>
<color name="material_deep_teal_500">#ff009688</color>
<color name="material_grey_100">#fff5f5f5</color>
<color name="material_grey_300">#ffe0e0e0</color>
<color name="material_grey_50">#fffafafa</color>
<color name="material_grey_600">#ff757575</color>
<color name="material_grey_800">#ff424242</color>
<color name="material_grey_850">#ff303030</color>
<color name="material_grey_900">#ff212121</color>
<color name="primary_dark_material_dark">#android:color/black</color>
<color name="primary_dark_material_light">#color/material_grey_600</color>
<color name="primary_material_dark">#color/material_grey_900</color>
<color name="primary_material_light">#color/material_grey_100</color>
<color name="primary_text_default_material_dark">#ffffffff</color>
<color name="primary_text_default_material_light">#de000000</color>
<color name="primary_text_disabled_material_dark">#4Dffffff</color>
<color name="primary_text_disabled_material_light">#39000000</color>
<color name="ripple_material_dark">#33ffffff</color>
<color name="ripple_material_light">#1f000000</color>
<color name="secondary_text_default_material_dark">#b3ffffff</color>
<color name="secondary_text_default_material_light">#8a000000</color>
<color name="secondary_text_disabled_material_dark">#36ffffff</color>
<color name="secondary_text_disabled_material_light">#24000000</color>
<color name="subtitle">#96ffffff</color>
<color name="sv_bgcolor">#d2000000</color>
<color name="switch_thumb_disabled_material_dark">#ff616161</color>
<color name="switch_thumb_disabled_material_light">#ffbdbdbd</color>
<color name="switch_thumb_normal_material_dark">#ffbdbdbd</color>
<color name="switch_thumb_normal_material_light">#fff1f1f1</color>
<color name="trans">#7cffffff</color>
<color name="tt_accent">#0099ff</color>
<color name="tt_accentdark">#0084dc</color>
<color name="tw__blue_default">#FF5BAAF4</color>
<color name="tw__blue_pressed">#FF4186C8</color>
<color name="tw__blue_pressed_light">#ffe1e8ed</color>
<color name="tw__composer_black">#ff292f33</color>
<color name="tw__composer_blue">#ff1da1f2</color>
<color name="tw__composer_blue_text">#ff1b95e0</color>
<color name="tw__composer_deep_gray">#ff8899A6</color>
<color name="tw__composer_light_gray">#ffccd6dd</color>
<color name="tw__composer_red">#ffe81c4f</color>
<color name="tw__composer_white">#ffffffff</color>
<color name="tw__light_gray">#ccd6dd</color>
<color name="tw__medium_gray">#8899a6</color>
<color name="tw__seekbar_thumb_inner_color">#ffffffff</color>
<color name="tw__seekbar_thumb_outer_color">#4dffffff</color>
<color name="tw__solid_white">#FFFFFFFF</color>
<color name="tw__transparent">#00000000</color>
<color name="tw__tweet_action_color">#55acee</color>
<color name="tw__tweet_action_dark_highlight_color">#667580</color>
<color name="tw__tweet_action_light_highlight_color">#ebeef0</color>
<color name="tw__tweet_dark_container_bg_color">#d9000000</color>
<color name="tw__tweet_dark_primary_text_color">#e1ffffff</color>
<color name="tw__tweet_light_container_bg_color">#ffffff</color>
<color name="tw__tweet_light_primary_text_color">#292f33</color>
<declare-styleable name="ActionBar"><attr name="navigationMode"><enum name="normal" value="0"/><enum name="listMode" value="1"/><enum name="tabMode" value="2"/></attr><attr name="displayOptions"><flag name="none" value="0"/><flag name="useLogo" value="0x1"/><flag name="showHome" value="0x2"/><flag name="homeAsUp" value="0x4"/><flag name="showTitle" value="0x8"/><flag name="showCustom" value="0x10"/><flag name="disableHome" value="0x20"/></attr><attr name="title"/><attr format="string" name="subtitle"/><attr format="reference" name="titleTextStyle"/><attr format="reference" name="subtitleTextStyle"/><attr format="reference" name="icon"/><attr format="reference" name="logo"/><attr format="reference" name="divider"/><attr format="reference" name="background"/><attr format="reference|color" name="backgroundStacked"/><attr format="reference|color" name="backgroundSplit"/><attr format="reference" name="customNavigationLayout"/><attr name="height"/><attr format="reference" name="homeLayout"/><attr format="reference" name="progressBarStyle"/><attr format="reference" name="indeterminateProgressStyle"/><attr format="dimension" name="progressBarPadding"/><attr name="homeAsUpIndicator"/><attr format="dimension" name="itemPadding"/><attr format="boolean" name="hideOnContentScroll"/><attr format="dimension" name="contentInsetStart"/><attr format="dimension" name="contentInsetEnd"/><attr format="dimension" name="contentInsetLeft"/><attr format="dimension" name="contentInsetRight"/><attr format="dimension" name="elevation"/><attr format="reference" name="popupTheme"/></declare-styleable>
<declare-styleable name="ActionBarLayout"><attr name="android:layout_gravity"/></declare-styleable>
<declare-styleable name="ActionMenuItemView"><attr name="android:minWidth"/></declare-styleable>
<declare-styleable name="ActionMenuView"/>
<declare-styleable name="ActionMode"><attr name="titleTextStyle"/><attr name="subtitleTextStyle"/><attr name="background"/><attr name="backgroundSplit"/><attr name="height"/><attr format="reference" name="closeItemLayout"/></declare-styleable>
<declare-styleable name="ActivityChooserView"><attr format="string" name="initialActivityCount"/><attr format="reference" name="expandActivityOverflowButtonDrawable"/></declare-styleable>
<declare-styleable name="AlertDialog"><attr name="android:layout"/><attr format="reference" name="buttonPanelSideLayout"/><attr format="reference" name="listLayout"/><attr format="reference" name="multiChoiceItemLayout"/><attr format="reference" name="singleChoiceItemLayout"/><attr format="reference" name="listItemLayout"/></declare-styleable>
<declare-styleable name="AppBarLayout"><attr name="elevation"/><attr name="android:background"/><attr format="boolean" name="expanded"/></declare-styleable>
<declare-styleable name="AppBarLayout_LayoutParams"><attr name="layout_scrollFlags"><flag name="scroll" value="0x1"/><flag name="exitUntilCollapsed" value="0x2"/><flag name="enterAlways" value="0x4"/><flag name="enterAlwaysCollapsed" value="0x8"/><flag name="snap" value="0x10"/></attr><attr format="reference" name="layout_scrollInterpolator"/></declare-styleable>
<declare-styleable name="AppCompatImageView"><attr name="android:src"/><attr format="reference" name="srcCompat"/></declare-styleable>
I had this issue as well.
In my case, the problem was that the support libraries in my gradle file's dependency section should all be the same version.
More info here:
Gradle error "Attribute "xxx" has already been defined" in Android Studio

TypedArray getColor always returns defValue

In my XML element I try to pass through colors from the colors.xml resource file. the getColor function always returns the defValue, even though it should return the colors given in the colors.xml.
code
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.accordion);
final int col_pressed = a.getColor(R.styleable.accordion_buttonColorPressed, Color.BLACK);
final int col_unpressed = a.getColor(R.styleable.accordion_buttonColorPressed, Color.YELLOW);
btn.setBackgroundColor(col_unpressed);
main XML
<mika.actual.AccordionWidget
xmlns:accordion="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
accordion:text_color="#color/text_color"
accordion:buttonColorPressed="#color/button_pressed"
accordion:buttonColorUnpressed="#color/button_not_pressed"
android:background="#FFFFFFFF"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"> ... </mika.actual.AccordionWidget>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="text_color">#FFFFFF</color>
<color name="button_pressed">#666666</color>
<color name="button_not_pressed">#BBBBBB</color>
</resources>
attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="accordion">
<attr name="text_color" format="color"/>
<attr name="buttonColorPressed" format="color"/>
<attr name="buttonColorUnpressed" format="color"/>
</declare-styleable>
</resources>
It's an old thread but no one respond. I will, so viewers can have an answer
I think you just have to change all your accordion: to app: like this
app:text_color="#color/text_color"
app:buttonColorPressed="#color/button_pressed"
app:buttonColorUnpressed="#color/button_not_pressed"

Is there any way to find out what these custom attributes do in the google iosched app?

I've been looking to the Google iosched 2014 app to ensure im following correct design patterns for material design and specifically for pre-L devices with the support v7 library and appcompat v21.
In order to use the material design theme you must inherit from "Theme.AppCompat", but i can't seem to understand or find any documentation of the styles attributes in the link below. They aren't under the "android:" namespace and i dont seem to be able to use them myself.
https://github.com/google/iosched/blob/master/android/src/main/res/values/styles.xml#L32-L38
<item name="actionBarIconColor">#fff</item>
<item name="actionBarInsetStart">#dimen/keyline_2</item>
<item name="homeAsUpIndicator">#drawable/ic_up</item>
<item name="spinnerBarInsetStart">#dimen/keyline_2_minus_16dp</item>
<item name="popupItemBackground">?android:selectableItemBackground</item>
<item name="photoItemForeground">?android:selectableItemBackground</item>
<item name="photoItemForegroundBorderless">?android:selectableItemBackground</item
I'm barely familiar with custom attributes in /attr folder, but how can i find where they are used.
<declare-styleable name="BaseTheme">
<attr name="actionBarIconColor" format="color" />
<attr name="actionBarInsetStart" format="dimension" />
<attr name="spinnerBarInsetStart" format="dimension" />
<attr name="popupItemBackground" format="reference" />
<attr name="photoItemForeground" format="reference" />
<attr name="photoItemForegroundBorderless" format="reference" />
</declare-styleable>
I don't understand how this custom set of attributes is being used and its bugging me. Can anyone explain to me whats going on here and how they attributes are being used?
Here's a search of the repository that shows some instances of where they are used:
https://github.com/google/iosched/search?utf8=%E2%9C%93&q=photoItemForeground

How to color the background of the application in android

I added a color folder, with this xml file:
<?xml version="1.0" encoding="utf-8"?>
<item
xmlns:android="http://schemas.android.com/apk/res/android">
<color name="orange">#FF9912</color>
</item>
But when I put as the value in the screen_display.xml that i created in the values folder. It gives me a mistake:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme.Background" parent="#android:style/Theme">
<item name="android:windowNoTitle"> true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">#colors/color/orange</item>
</style>
</resources>
UPDATE
<activity android:name=".EasyLearningActivity"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:theme="MyTheme.Background"...shows mistake, saying that Strying type inst allowed :(
>
pls chk out this
in values folder create two xml file first one
color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="orange">#FF9912</color>
</resources>
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme.Background" parent="#android:style/Theme">
<item name="android:windowNoTitle"> true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">#color/orange</item>
</style>
</resources>
In manifest file:
<activity android:name=".EasyLearningActivity"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:theme="#style/MyTheme.Background"></activity>
It's #color, not #colors...
and are you setting the android:theme attribute for your application tag in the manifest to use MyTheme.Background?
You can't use directly string for android:theme.
You need to include one of the styles like **#style/**MyTheme.Background.
Thanks for the color.xml , finally after 7 hours of research and lots of frustration I now have a purple action bar like I wanted.
<color name="orange" type="color">#FF9912</color>
<color name="red" type="color">#FF0000</color>
<color name="blue" type="color">#FF33B5E5</color>
<color name="purple" type="color">#FFAA66CC</color>
<color name="green" type="color">#FF99CC00</color>
<color name="darkblue" type="color">#FF0099CC</color>
<color name="darkpurple" type="color">#FF9933CC</color>
<color name="darkgreen" type="color">#FF669900</color>
<color name="darkorange" type="color">#FFFF8800</color>
<color name="darkred" type="color">#FFCC0000</color>
<!--Black #000000 (0,0,0)
White #FFFFFF (255,255,255)
Red #FF0000 (255,0,0)
Lime #00FF00 (0,255,0)
Blue #0000FF (0,0,255)
Yellow #FFFF00 (255,255,0)
Cyan / Aqua #00FFFF (0,255,255)
Magenta / Fuchsia #FF00FF (255,0,255)
Silver #C0C0C0 (192,192,192)
Gray #808080 (128,128,128)
Maroon #800000 (128,0,0)
Olive #808000 (128,128,0)
Green #008000 (0,128,0)
Purple #800080 (128,0,128)
Teal #008080 (0,128,128)
Navy #000080 (0,0,12-->
<!--color name="orange" type="color">#FFFFBB33</color-->
<!--<color name="red" type="color">#FFFF4444</color-->

Categories

Resources