Android Set ImageView image src in Style

前端 未结 1 528
再見小時候
再見小時候 2021-01-02 02:23

I need to set the ImageView\'s src within my style, but I cant find a good example of anyone doing this and when I try the below code, it crashes the app.

&l         


        
相关标签:
1条回答
  • 2021-01-02 02:37

    Your xml is incorrect:

    <ImageView style="@style/TitleBarImage" />
    

    And styles.xml :

    <style name="TitleBarImage">     
        <item name="android:layout_width">wrap_content</item>     
        <item name="android:layout_height">wrap_content</item>     
        <item name="android:src">@drawable/whiteButton</item> 
    </style> 
    
    0 讨论(0)
提交回复
热议问题