how do I fix the width of each element in the horizontal linear layout. As shown in this picture?
I have updated the question with the code. Help would be appreciated. thank you!
<
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/l1"
android:orientation="horizontal"
android:layout_height="87dp"
android:layout_width="match_parent"
android:paddingBottom="9dp"
android:paddingLeft="19dp"
android:paddingRight="19dp"
android:paddingTop="9dp"
android:gravity="center"
>
<ImageView
android:id="@+id/fbprofile_picture"
android:layout_width="63dp"
android:layout_height="63dp"
android:src="@drawable/ic_logo_new"/>
<TextView
android:id="@+id/fbprofile_name"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:fontFamily="sans-serif-condensed"
android:paddingLeft="17dp"
android:paddingRight="17dp"
android:text="Faiza Zainab Ahmad " />
<TextView
android:id="@+id/btn_fbfriends_connect"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_weight="2.31"
android:background="@color/ThemeLightBlue"
android:gravity="center"
android:padding="8dp"
android:text="CONNECT"
android:textColor="#ffffff"
android:textSize="16sp"
/>
</LinearLayout>
>
Try this, the ImageView and the Button will keep their size and the TextView will fill the rest of the space.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:scaleType="fitCenter"
android:src="@drawable/my_image" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_weight="1"
android:text="Some text" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="The Button" />
</LinearLayout>