2

In theory a simple thing. I would like to change the background color of toast (android:minSdkVersion="14" android:targetSdkVersion="18"). What I did? I've found the Theme.Holo.Light definition which I use as parent for my own style:

Theme.Holo.Light definition

Next I've found:

<item name="android:toastFrameBackground">

Nest I wanted to modify it:

<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="MyTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBarStyle</item>
<item name="android:toastFrameBackground">@android:color/holo_blue_light</item>

etc.

While for Action Bar it works without problems, for toastFrameBackground eclipse displays always:

error: Error: No resource found that matches the given name: attr 'android:toastFrameBackground'. styles.xml Android AAPT Problem

I've even set it to the original version (just copied from original theme definition):

<item name="toastFrameBackground">@android:drawable/toast_frame</item>

Hoping it should work. No way.

When I click ctr+space Eclipse it seems not to see toastFrameBackground. Why? I've checked some other items from original theme definition and some seems to be visible, while others no.

Any idea? help?

I've spent 3-4 hours and nothing... Probably I will keep the original toast background color as it seems it's not worth to fight but I would prefer to understand deeper the mechanism. Why I don't have an access to the item it seems I should have an access.

user2707175
  • 1,133
  • 2
  • 17
  • 44

1 Answers1

2

That's because toastFrameBackground is not exported and did not make to public.xml, which means this attribute is not available for non-platform/third-party applications.

However, you may want to see https://stackoverflow.com/a/9903465/1893766 for what you are trying to achieve.

Community
  • 1
  • 1
ozbek
  • 20,955
  • 5
  • 61
  • 84
  • Great. It's what I need. Although I don't understand the philosophy why only some elements are public in case of styles. – user2707175 Oct 07 '13 at 13:26
  • Btw, how do create the correct drawable for toast bacground. For sure I can set only color but then the toast doesn't have this 3d look. – user2707175 Oct 07 '13 at 13:27
  • @user2707175: Sorry, I have not tried something like that myself. – ozbek Oct 07 '13 at 16:03