2

I have Imagebutton with src="@drawable/abc_ic_menu_moreoverflow_mtrl_alpha" using appcompat-v7 21.0.3.

<ImageButton
  android:layout_width="@dimen/abc_action_button_min_height_material"
  android:layout_height="@dimen/abc_action_button_min_height_material"
  android:layout_alignParentRight="true"
  android:background="?attr/selectableItemBackground"
  android:src="@drawable/abc_ic_menu_moreoverflow_mtrl_alpha" />

It's showing me black overflow button until api 20. In api >=21 It shows white icon which is not visible correctly in my layout.

See Images.

In kitkat enter image description here

In Lollipop enter image description here

As seen, It's white in >=21 .

I have single styles.xml file for all versions as follows.

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/blue</item>
        <item name="colorAccent">@color/white</item>

    </style>

So , what should be hack here , any help would be great.

Note : -I am using this button in recyclerview item layout. 

       -Appcompat v7-22.2.0 produces the same result.
Oceinic
  • 406
  • 4
  • 15
MohK
  • 1,873
  • 1
  • 18
  • 29
  • I think it's using your Accent color. Try overriding the color in values-v21 – niranjan94 Jun 04 '15 at 12:49
  • Or if that doesn't work, manually tint the icon (programmatically) – niranjan94 Jun 04 '15 at 12:52
  • thnx for suggession , overriding accent color not working. An manually tinting may overhelm the system , what you say , as it's in recyclerview item layout. – MohK Jun 05 '15 at 05:45
  • 1
    There should be nothing wrong when setting the `android:tint` property. [See the docs](https://developer.android.com/reference/android/widget/ImageView.html#attr_android:tint) – reVerse Jun 05 '15 at 18:23
  • android:tint works great. thank you. @reVerse . – MohK Jun 08 '15 at 06:31

1 Answers1

3

As suggested by @reVerse ,

android:tint works great which tints the image with specified color.

MohK
  • 1,873
  • 1
  • 18
  • 29