2016-09-21 3 views
-4

Ich habe ein paar Antworten versucht, hier How do I make a dotted/dashed line in Android?Wie zeichne ich eine dicke gestrichelte Linie mit XML?

aber die Linien sind alle dünn.

Was ich brauche, ist etwas, das etwas 10 mal dicker ist. Vielen Dank für das Lesen

-Code resultieren aus richtige Antwort:

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.tester.MainActivity"> 

    <ImageView 
    android:layout_width="match_parent" 
    android:layout_height="20dp" 
    android:src="@drawable/dotted" 
    android:layerType="software"/> 
</RelativeLayout> 

dotted.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="line" > 
    <stroke 
    android:dashGap="10px" 
    android:dashWidth="10px" 
    android:width="10dp" 
    android:color="@android:color/black" 
    /> 
</shape> 

Thick dotted line

+0

Solch eine dumme Frage! – Piyush

+0

@Piyush, Vorsicht, um auf den 'dummen' Teil näherzugehen? –

Antwort

2

In unten xml können Sie die Breite nach Ihren Bedürfnissen ändern.

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="line"> 

     <stroke 
      android:color="#C7B299" 
      android:dashWidth="10px" 
      android:dashGap="10px" 
      android:width="10dp"/> 
    </shape> 
+0

Hilft Ihnen das? @Short Antwort –

+0

Welche Form haben Sie definiert? Kannst du das komplette XML posten? –

Verwandte Themen