首页 > 解决方案 > 如何在 android 中制作 IconButton?

问题描述

在使用 react native 很长一段时间后,我正在研究 android,但我似乎在 android 中找不到任何关于 IconButtons 的信息,比如这里的:

https://callstack.github.io/react-native-paper/icon-button.html

谢谢

标签: androidreact-nativereact-native-paper

解决方案


ImageButton它在Android中称为an 。

<ImageButton
    android:id="@+id/favorite_imageButton"
    android:layout_width="wrap_content"
    android:layout_height="48dp"
    android:layout_marginTop="@dimen/margin_extra_small"
    android:layout_marginEnd="@dimen/margin_extra_small"
    android:layout_marginBottom="@dimen/margin_extra_small"
    android:background="?selectableItemBackgroundBorderless"
    android:padding="@dimen/margin_extra_small"
    android:src="@drawable/ic_star_border"
    android:tint="?attr/colorOnBackground"       
    app:layout_constraintBottom_toBottomOf="@id/up_navigation_imageButton"
    app:layout_constraintRight_toLeftOf="@id/game_link_imageButton"
    app:layout_constraintTop_toTopOf="@id/up_navigation_imageButton"
    tools:src="@drawable/ic_star_border" />

推荐阅读