I have the following command in my layout and I want to organize my layout so that the textview category stays on the FFImageLoading
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:background="#000000"
android:id="@+id/L_imgF1F2">
<LinearLayout
android:layout_width="0dip"
android:layout_height="125dp"
android:orientation="vertical"
android:gravity="bottom"
android:layout_weight="1"
android:id="@+id/imgF1"
android:layout_marginRight="2dp">
<FFImageLoading.Views.ImageViewAsync
android:id="@+id/imazhi"
android:layout_width="100dp"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:layout_marginLeft="4dp"
android:backgroundTint="#00000000" />
<TextView
android:id="@+id/CategoryF1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Category"
android:textSize="12dp"
android:padding="2dp"
android:textColor="#ffffff"
android:gravity="left" />
</LinearLayout>
I want my layout to be organized like this, As in the picture enter image description here
You aren't going to be able to use a LinearLayout
here. The purpose of a LinearLayout
is to stack Views
one after the other. You should use a RelativeLayout
, then on your TextView
, set android:layout_alignBottom="true"
, then set android:layout_margin
to something appropriate to get it moved up and to the right a bit. Here's all of that together:
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:background="#000000"
android:id="@+id/L_imgF1F2">
<RelativeLayout
android:layout_width="0dip"
android:layout_height="125dp"
android:gravity="bottom"
android:layout_weight="1"
android:id="@+id/imgF1"
android:layout_marginRight="2dp">
<FFImageLoading.Views.ImageViewAsync
android:id="@+id/imazhi"
android:layout_width="100dp"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:layout_marginLeft="4dp"
android:backgroundTint="#00000000" />
<TextView
android:id="@+id/CategoryF1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="true"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:text="Category"
android:textSize="12dp"
android:padding="2dp"
android:textColor="#ffffff"
android:gravity="left" />
</RelativeLayout>