[英]Icon location problem with drawable Start in Android Studio
I have an editetext and I used drawable start, but the icon is not in the right place during execution我有一个editetext并且我使用了drawable start,但是在执行过程中图标不在正确的位置
Inside view of Android Studio Android Studio内部视图
First I put a scrollview, then a LinearLayout, inside it is a ConstraintLayout, then editText.首先我放了一个滚动视图,然后是一个LinearLayout,里面是一个ConstraintLayout,然后是editText。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Activity.Activityy.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:text="Hi Rechard"
android:textColor="#FF6D00"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:layout_marginTop="8dp"
android:text="@string/order_eat"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/textView"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="82dp"
android:layout_height="78dp"
android:layout_marginEnd="32dp"
android:src="@drawable/_f5736be590fe78e73bc4e4d7c012dda"
app:layout_constraintBottom_toBottomOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView" />
<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="315dp"
android:layout_height="68dp"
android:layout_marginStart="8dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="8dp"
android:background="@drawable/search_background"
android:drawableStart="@drawable/icons8_search_32"
android:drawablePadding="10dp"
android:ems="10"
android:hint="Find Your Food"
android:inputType="textPersonName"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
Inside the execution, the texts have also moved to the right, while they are on the left side of the design.在执行过程中,文本也移到了右侧,而它们位于设计的左侧。
in android start
means left
and end
means right
在 android 中
start
表示left
, end
表示right
you must use android:drawableEnd="ICON"
instead of android:drawableStart="ICON"
to set icon right side.您必须使用
android:drawableEnd="ICON"
而不是android:drawableStart="ICON"
来设置图标右侧。
My phone's language is right, but my design is left, so when I run, it is automatically directed to the right After a lot of research, I was able to solve my problem Just go to the manifest file And make the following line我手机的语言是正确的,但是我的设计是左边的,所以当我运行时,它会自动指向右边 经过大量研究,我能够解决我的问题只需 go 到清单文件并制作以下行
android:supportsRtl="true"
To至
android:supportsRtl="false"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.