OiO.lk Blog Android How to allign textView with bullet points in a linear layout in Android
Android

How to allign textView with bullet points in a linear layout in Android


I have the following XML layout file

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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=".FR_Options">

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true">

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

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical"
                android:padding="5dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="@string/cap_efficiency"
                    android:textSize="13sp"
                    android:textStyle="bold" />

                <ImageView
                    android:layout_width="250dp"
                    android:layout_height="160dp"
                    android:src="@drawable/facts_efficiency_english" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/info_efficiency_test"
                    android:textSize="8sp" />
            </LinearLayout>

        </LinearLayout>
    </HorizontalScrollView>

</FrameLayout>

with the following resource

    <string name="info_efficiency_test">
    • Lorem ipsum dolor sit amet, consectetur.\n
    • Aliquam finibus justo ut enim, pulvinar gravida.\n
    • Donec euismod ligula nec tortor ornare, efficitur.\n
    • Vivamus tincidunt arcu sit amet dolor lobortis.\n
    • Proin rhoncus, velit ac faucibus volutpat, justo arcu.\n
    • Phasellus auctor lacus, ullamcorper varius purus, tempor nunc.\n
    • Pellentesque habitant morbi tristique senectus, netus et malesuada.
</string>

I would like the bullet points to start at the same horitzontal position as the textView in this linear layout. In the ConstraintLayout I would allign the start of the textView with the start of the imageView. But this does not work.



You need to sign in to view this answers

Exit mobile version