I am working on a UI in which i want to align my Textview to right of ImageView as well as below of that same ImageView. I want this because, if i align the TextView Right of the ImageView, its leaving some empty space below the ImageView.
Below are the screenshots:
Current Situtaion: https://drive.google.com/open?id=0B6J8T8u_aeWrWWptZTJqTzVMTkk
Requirement: https://drive.google.com/open?id=0B6J8T8u_aeWrbXVnNVJEd0g2dWM
XML:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.meg7.widget.RectangleImageView
android:id="@+id/ivUserProfilePictureWOQ"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="@drawable/splash_image" />
<LinearLayout
android:id="@+id/ll_woq_quote_name"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/ivUserProfilePictureWOQ">
<TextView
android:id="@+id/tv_woq_user_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Name"/>
<TextView
android:id="@+id/tv_woq_user_quotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Qoute"
android:textSize="20dp"
android:textIsSelectable="true" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_woq_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ivUserProfilePictureWOQ"
android:orientation="vertical">
<TextView
android:id="@+id/tv_woq_tags"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="18dp"
android:padding="5dp"
android:text="tags" />
<TextView
android:id="@+id/tv_woq_likes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="14dp"
android:padding="5dp"
android:text="likes" />
</LinearLayout>
</LinearLayout>
So i just created a xml
as u require , Just use this in your project
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:gravity="center"
android:padding="7dp">
<com.meg7.widget.RectangleImageView
android:id="@+id/ivUserProfilePictureWOQ"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerCrop"
android:src="@drawable/splash_image" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_woq_quote_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".8"
android:orientation="vertical"
android:padding="5dp"
android:weightSum="1">
<TextView
android:id="@+id/tv_woq_user_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".2"
android:text="Einstien" />
<TextView
android:id="@+id/tv_woq_user_quotes"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight=".8"
android:maxLines="2"
android:text="This is dummy text and check use this in project , do tell me if its working fine or not ......."
android:textIsSelectable="true"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_desciption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="ExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExampleExample"
android:textSize="18dp" />
<LinearLayout
android:id="@+id/ll_woq_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_woq_tags"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:text="tags"
android:textSize="18dp" />
<TextView
android:id="@+id/tv_woq_likes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:text="likes"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
不要重新发明轮子,如果可以的话,请使用库: http : //deano2390.github.io/FlowTextView/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.