S
S
swpavlov2020-05-12 01:11:15
android studio
swpavlov, 2020-05-12 01:11:15

How to add an icon to a button?

Can't add icons to buttons

activity_main code:

<Button
            android:id="@+id/signInVk"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:drawableLeft="@drawable/vk-1"
            android:background="@drawable/btn_sign_in"
            android:fontFamily="sans-serif"
            android:text="@string/text_in_log_vk"
            android:textColor="@android:color/black"
            android:textSize="20sp" />


code from btn_sign_in:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:color="@color/ripple_effect"
    tools:targetApi="lollipop">

    <item>
        <shape android:shape="rectangle">
            <solid android:color="@android:color/white"></solid>
            <stroke android:color="@android:color/white" android:width="0dp"></stroke>
            <corners android:radius="100dp"></corners>
        </shape>
    </item>
</ripple>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question