Search code examples
androidreact-nativereact-native-paper

How do I make an IconButton in android?


I'm studying android after using react native for quite a while and I can't seem to find anything about IconButtons in android like the ones here:

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

Thanks


Solution

  • It's called an ImageButton in Android.

    <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" />