Hi ich habe den folgenden edittext zu erstellen, aber ich weiß nicht wie, ich habe gedacht, dass einfach fügen Sie es als Hintergrund wird mit Som Padding helfen, aber es nicht
Antworten:
-1 für die Antwort № 1Sie können eine XML-Datei in Drawable erstellen und diese XML dann als Hintergrund auf Ihren Editiertext anwenden. Der folgende Beispielcode fügt Ihrem Editiertext abgerundete Ecken hinzu
gerundete_ecke.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="@android:color/transparent" >
</solid>
<!-- view border color and width -->
<stroke
android:width="2dp"
android:color="#ff6600" >
</stroke>
<!-- If you want to add some padding -->
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp" >
</padding>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
</shape>
Dann wenden Sie diese XML-Datei in Ihrer Layout-Datei an editext an
<EditText
android:id="@+id/neworder_route_from"
android:background="@drawable/rounded_corners"
android:layout_margin="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From"
android:padding="10dp" />