Hans Baum Hans Baum - 2 months ago 7
Android Question

Text between 2 hr's in Android



how can I program a text between two horizontal lines in Android like in Instagram (see picture)?

enter image description here

Answer

try this way

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <View
            android:layout_width="0dp"
            android:layout_height="1dp"
android:background="#000000"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/order"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ODER"
            android:textColor="#ffffff"
            android:textSize="14sp" />

        <View
            android:layout_width="0dp"
            android:layout_height="1dp"
android:background="#000000"
            android:layout_weight="1"/>

    </LinearLayout>