Reputation: 18251
I have ImageButton with Android icon:
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="Icon"
android:src="@drawable/ic_android"
/>
How to change this icon to "confirm". I would like to use icon from standard Android library. How to do that? What logic I should go find required icon in standard Android library?
Upvotes: 0
Views: 321
Reputation: 1404
Android Studio already has bunch of commonly used icons. Steps to get the icon :
drawable
folderUpvotes: 0
Reputation: 1463
It seems that you are new to Android!
use Material button if you like to have more features.
<com.google.android.material.button.MaterialButton
android:id="@+id/confirmBtn"
style="@style/Widget.Material3.Button.IconButton.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="Confirm"
android:textAlignment="center"
android:textSize="16dp"
app:icon="@drawable/ic_android
app:iconGravity="textEnd"
app:iconPadding="8dp"
app:backgroundTint="@color/green"/>
Image button has only a icon without any text or label.
You can also use android <Button
tag instead and set its text
to "confirm".
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_android"
android:text="Confirm"/>
Try to change <Button
tag to <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
and see the result.
Upvotes: 0