Add a Login with Amazon Button to your app
→
→
Login with Amazon provides several standard buttons you can use to prompt users to login from your app. This section gives steps for downloading an official Login with Amazon image and pairing it with an Android ImageButton
.
- Add a standard
ImageButton
to your app. For more information on Android buttons and theImageButton
class, see Buttons on developer.android.com. -
Give your button an id. In the button XML declaration, set the
android:id
attribute to@+id/login_with_amazon
. For example:android:id="@+id/login_with_amazon"
- Choose a button image. Consult our Login with Amazon Button Guidelines for a list of buttons you can use in your app. Download a copy of the
LWA_Android.zip
file. Extract a copy of your preferred button for each screen density your app supports (xxhdpi, xhdpi, hdpi, mdpi, or tvdpi). For more information on supporting multiple screen densities in Android, see Alternative Layouts in the "Supporting Multiple Screens" topic on developer.android.com. - Copy the appropriate button image files to your project. For each screen density you support (xhdpi, hdpi, mdpi, or ldpi), copy the downloaded button to the
res/drawable
directory for that screen density. -
Declare the button image. In the button XML declaration, set the
android:src
attribute to the name of the button you have chosen. For example:android:src="@drawable/btnlwa_gold_loginwithamazon.png"
- Load your app, and verify that the button now has a Login with Amazon image. You should verify the button displays properly for each screen density you support.