代码之家  ›  专栏  ›  技术社区  ›  Azeem Haider

图层列表中的可绘制颜色错误

  •  1
  • Azeem Haider  · 技术社区  · 7 年前

    我只想在我的图像按钮中添加背景

    这是我正在做的。

    <?xml version=“1.0”encoding=“utf-8”?gt;
    <layer list xmlns:android=“http://schemas.android.com/apk/res/android”>
    <项目>
    <shape安卓:shape=“椭圆形”>
    <笔画
    安卓:width=“1dp”
    
    
    
    
    
    
    
    

    ic_mic imageAssets

    icon with background color

    png enter image description here

    switch

    <Switch
       andoird:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:background="@color/red" />
    
    2 回复  |  直到 7 年前
        1
  •  1
  •   Syed Danish Haider    7 年前

     <ImageButton
        android:id="@+id/badge_notificatidon_2"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:background="@drawable/item_count" 
        android:src="@drawable/ic_mic"/>//use src your icon 
        vector drawable or png image
    

     <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <corners android:radius="8dp" />
    <solid android:color="#01b9f5" />
    <stroke
        android:width="3dip"
        android:color="#c6c6c6" />
    <padding
        android:bottom="5dp"
        android:left="5dp"
        android:right="5dp"
        android:top="5dp" />
    </shape>
    
        2
  •  0
  •   user10041244    7 年前