'Is there any way to add a favourite button on the image?
I'm currently working on mobile application by using the kotlin language. May I know is it possible to add a favorite button on the image that the user can click it? If it is possible, then how is it?
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/toggleButtonGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/ic_favorite"
style="@style/ToggleButtonWithIconOnly"
app:icon="@drawable/ic_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</com.google.android.material.button.MaterialButtonToggleGroup>
<ImageView
android:id="@+id/cake"
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_marginTop="30dp"
android:layout_marginStart="55dp"
app:srcCompat="@drawable/fgh" />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|