Ich arbeite derzeit an der Erstellung einer line styled button
Show im Bild unten.create line styled button in android
Ich habe keine Ahnung, wie man create a lined button
, wie ich auf Android-Programmierung neu bin.
Bitte helfen?
Danke
Ich arbeite derzeit an der Erstellung einer line styled button
Show im Bild unten.create line styled button in android
Ich habe keine Ahnung, wie man create a lined button
, wie ich auf Android-Programmierung neu bin.
Bitte helfen?
Danke
Verwendung shape drawable
shape.xml
in ziehbar
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<stroke android:width="5px" android:color="#1a1a1a" />
</shape>
layout.xml
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape"/>
für weitere Einzelheiten 012 sehenTutorials für android
Überprüfen Sie die folgenden Code wird es Ihnen helfen
rounded_button.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:bottom="12dp"
android:left="12dp"
android:right="12dp"
android:top="12dp"/>
<stroke
android:width="2dp"
android:color="#3c993c"/>
<corners android:radius="5dp"/>
</shape>
In Aktivität Xml
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_button"
android:text="Refresh"
android:textSize="14sp"/>
Ausgang:
in Android alle Layout wird von XML-Datei festgelegt, können Sie die Form und die Farbe Ihrer Schaltfläche nur mithilfe einer XML-Datei definieren.
Zuerst müssen Sie eine Datei namens boneshape.xml im Drawable-Ordner erstellen.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners android:radius="8dp"/>
<solid android:color="#FFF"/>
<size
android:width="275dp"
android:height="50dp"/>
<stroke
android:width="2dp"
android:color="#19a865"/>
</shape>
Dann müssen Sie auf der Schaltfläche, die Sie diese XML als Hintergrund verwenden möchten, sagen.
<Button
android:text="Refresh"
android:textColor="#19a865"
android:textSize="30sp"
android:layout_width="275dp"
android:layout_height="50dp"
android:background="@drawable/buttonshape"/>
Ausgang:
Das ist alles!
Was haben Sie bisher versucht? Bitte erwarten Sie keinen kostenlosen Code oder keine Recherche! –
eine einfache Form mit einem Strich als XML-Layout wird den Trick tun .... – Opiatefuchs