please find below my layout & its result ; I need the text 'Text message' to align on the baseline of the text 'Header'(Please find below the code and snapshot). Would be glad if someone can give me direction
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0"
android:baselineAligned="true"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2"
android:background="@color/custom_orange"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Header"
android:textSize="25sp"
android:id="@+id/title"
android:gravity="center"
android:background="@color/custom_red"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Text message"
android:textSize="10sp"
android:id="@+id/language"
android:gravity="center"
android:background="@color/custom_green"/>
</LinearLayout>
</LinearLayout>
This is the result
This is what I need
Use RelativeLayout as a container for TextViews and add the attribute
android:layout_alignBaseline="@+id/title"
to id/language TextView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With