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
ImageButtonto your app. For more information on Android buttons and theImageButtonclass, see Buttons on developer.android.com. -
Give your button an id. In the button XML declaration, set the
android:idattribute 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.zipfile. 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/drawabledirectory for that screen density. -
Declare the button image. In the button XML declaration, set the
android:srcattribute 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.

