0

I am trying to move the arrow button the the right side so it wont be in my text any one can help me?? Button

this is the style code:

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <layer-list>
            <item>
                <shape android:shape="rectangle">

                    <solid android:color="#FFFFFF"/>

                    <padding android:right="10dp"/>
                </shape>
            </item>
            <item>

                <bitmap      android:src="@drawable/style" android:gravity="center|right"/>
            </item>
        </layer-list>
    </item>

</selector>

I tried to change gravity but it wont work

ADM
  • 20,406
  • 11
  • 52
  • 83
Modio Yt
  • 9
  • 5
  • 1
    Why not just set a `drawableEnd` ? – ADM Jul 13 '21 at 04:50
  • can u explain more? @ADM – Modio Yt Jul 13 '21 at 05:09
  • what i understand from the image u provided you need an icon on the right side of Button . That can be done with `android:drawableEnd="@drawable/arrow"` . If that does not solve ur problem add some more detail with question of expected and current output . – ADM Jul 13 '21 at 05:11
  • Yes thats exactly what i need but this is a spinner not a button and i tried to do like what you said but it wont work , if u want i can send picture of the code @ADM – Modio Yt Jul 13 '21 at 05:26
  • Your code seems fine its the width of the spinner which is causing overlap i guess . See [This thread](https://stackoverflow.com/a/34772832/4168607). – ADM Jul 13 '21 at 05:28

1 Answers1

0

Hey you can use material design button that will helpful

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:iconGravity="end"
    android:background="@android:color/white"
    android:backgroundTint="@android:color/white"
    android:text="A+20"
    app:icon="@drawable/ic_baseline_arrow_forward_24"
   style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
/>

source: https://material.io/components/buttons/android#text-button

Nitin Prakash
  • 927
  • 9
  • 16