Setting image source for ToggleButton

前端 未结 5 2230
旧巷少年郎
旧巷少年郎 2020-12-24 15:17

I have a 30px x 30px png file that i would like to use as an android:src rather than an android:background. By using it as the background, and mentioning \"wrap_content\" fo

5条回答
  •  清歌不尽
    2020-12-24 15:29

    "Quick and dirty" way of achieving this is to use relative layout and place your ImageView on top of the ToggleButton. Set android:layout_centerInParent="true" and set your onClick listener on the toggle

    Said that - the other solution by CaseyB (customizing background files) is the right approach

提交回复
热议问题