I am developing an Android app that has a button which spawns a browser. To make this…
- User
I am developing an Android app that has a button which spawns a browser. To make this clear to the user, I want to add an 'external link' icon after the button text. Which
android:drawableresource should I use? Assistant
To add an external link icon (🌐) to your Android button, use the Material Design "open in new" icon (
ic_open_in_new). Here's how to implement it:
1. Use Material Design Icon (Recommended)
Add the Material Components dependency in your
build.gradle(if not already included):implementation 'com.google.android.material:material:1.9.0'Then, set the icon in your
Button/MaterialButtonXML:<com.google.android.material.button.MaterialButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Visit Website" app:icon="@drawable/ic_open_in_new_black_24dp" <!-- Icon --> app:iconGravity="textEnd" <!-- Place icon after text --> app:iconTint="@color/your_color" <!-- Optional: Set icon color --> />
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.