N
N
Nikolai2019-06-03 12:26:27
Android
Nikolai, 2019-06-03 12:26:27

How to make dots between TextView?

How to make such points between the views?
5cf4e7ba6748e146025427.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Emelyanov, 2019-06-03
Demidovets @Nik_o_lay

For example, such a solution

<?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"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <TextView
        android:id="@+id/t1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:text="кальмары"
        app:layout_constraintStart_toStartOf="parent" />

    <View
        android:id="@+id/t2"
        android:layout_width="0dp"
        android:layout_height="2dp"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/dotted"
        app:layout_constraintBottom_toBottomOf="@+id/t1"
        app:layout_constraintEnd_toStartOf="@+id/t3"
        app:layout_constraintStart_toEndOf="@+id/t1" />

    <TextView
        android:id="@+id/t3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:text="5 шт."
        app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

dotted.xml
<?xml version="1.0" encoding="utf-8"?>
<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="1dp"/>
</shape>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question