how to make ImageView which is between two elements to margin left of the 'left element' using RelativeLayout? - android-layout

What I want is to make the 'edit' ImageView between '6.4 MB' TextView and '···'TextView, and let 'edit' ImageView close to '···'TextView.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_marginTop="15dp"
android:layout_height="match_parent">
<ImageView
android:src="#drawable/screenshot"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="#+id/screenShot"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
/>
<TextView
android:text="Video Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="23dp"
android:textColor="#000000"
android:id="#+id/videoName"
android:layout_toRightOf="#id/screenShot"
android:layout_alignParentTop="true"
/>
<TextView
android:text="2021.05.19 · 5:11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="15dp"
android:textColor="#797675"
android:id="#+id/recordDate"
android:layout_toRightOf="#id/screenShot"
android:layout_below="#id/videoName"
/>
<TextView
android:text="6.4 MB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="15dp"
android:textColor="#797675"
android:id="#+id/videoSize"
android:layout_toRightOf="#id/screenShot"
android:layout_alignBottom="#id/screenShot"
/>
<ImageView
android:src="#drawable/edit"
android:layout_width="27dp"
android:layout_height="27dp"
android:id="#+id/edit"
android:layout_toRightOf="#id/videoSize"
android:layout_toLeftOf="#id/edit"
android:layout_alignBottom="#id/screenShot"
/>
<TextView
android:text="···"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="40dp"
android:textColor="#000000"
android:id="#+id/moreAction"
android:layout_alignBottom="#id/screenShot"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
If I use android:layout_marginLeft="40dp" in 'edit' ImageView, then the 'edit' ImageView will disappear.
Why android:layout_marginLeft is noting working?
anyone can help?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/screenShot"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
android:src="#drawable/ic_launcher_background" />
<TextView
android:id="#+id/videoName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="0dp"
android:layout_toRightOf="#id/screenShot"
android:text="Video Name"
android:textColor="#000000"
android:textSize="23dp" />
<TextView
android:id="#+id/recordDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/videoName"
android:layout_marginLeft="0dp"
android:layout_toRightOf="#id/screenShot"
android:text="2021.05.19 · 5:11"
android:textColor="#797675"
android:textSize="15dp" />
<TextView
android:id="#+id/videoSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/screenShot"
android:layout_marginLeft="0dp"
android:layout_toRightOf="#id/screenShot"
android:text="6.4 MB"
android:textColor="#797675"
android:textSize="15dp" />
**<ImageView
android:id="#+id/edit"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignBottom="#id/screenShot"
android:layout_marginRight="16dp"
android:layout_toLeftOf="#id/moreAction"
android:src="#drawable/ic_baseline_content_cut_24" />**
<TextView
android:id="#+id/moreAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/screenShot"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:text="···"
android:textColor="#000000"
android:textSize="40dp" />

I shall remove
android:layout_toLeftOf="#id/edit"
and add
android:layout_marginLeft="170dp"
the complete 'edit' ImageView code is like below:
<ImageView
android:src="#drawable/edit"
android:layout_width="27dp"
android:layout_height="27dp"
android:id="#+id/edit"
android:layout_toRightOf="#id/videoSize"
android:layout_marginLeft="170dp"
android:layout_alignBottom="#id/screenShot"
/>

Related

How to do horizontal scrolling,vertical scrolling and tab box textview horizontal scrolling in an activity

I am facing some problem in designing one screen in which vertical page scrolling, horizontal page scrolling and tab box textview horizontal scrolling work(if textView bigger than box).
I have attach a required image. please give me some idea, so that i can design this screen.
See required design:
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="0"
android:padding="5dp"
android:text="Sr. no"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_row="0"
android:padding="5dp"
android:text="Name owner address"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="3"
android:layout_row="0"
android:padding="5dp"
android:text="Sizes"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="4"
android:layout_row="0"
android:padding="5dp"
android:text="BHkk"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="5"
android:layout_row="0"
android:padding="5dp"
android:text="Call et.c."
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView6"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="2"
android:text="1" />
<TextView
android:id="#+id/textView7"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_row="2"
android:text="#string/dummyText" />
<TextView
android:id="#+id/textView8"
android:layout_width="39dp"
android:layout_height="wrap_content"
android:layout_column="3"
android:layout_row="2"
android:text="New Text" />
<TextView
android:id="#+id/textView9"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:layout_column="4"
android:layout_row="2"
android:text="10dp" />
<TextView
android:id="#+id/textView10"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_column="5"
android:layout_row="2"
android:text="New Text" />
</GridLayout>
</ScrollView>
</HorizontalScrollView>

how to design responsive image button & layout by using android studio?

i am new to android development . I designed one parking app , but the layout is not responsive to all mobile devices.
I tried to make responsive image buttons by using 9patch png images & by taking different drawable folder(hdpi,mdpi,xhdpi) . But both are not working for large screen devices.
This is one sample xml file:
<?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:background="#drawable/background"
>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/exit"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:src="#drawable/exit1"
android:onClick="on_Bexit"
android:layout_alignTop="#+id/home0"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/home0"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:src="#drawable/home1"
android:onClick="on_Bhome0"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/car"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:src="#drawable/c4"
android:onClick="on_Bcar"
android:cropToPadding="true"
android:nestedScrollingEnabled="true"
android:layout_alignBottom="#+id/textView5"
android:layout_alignLeft="#+id/bike"
android:layout_alignStart="#+id/bike" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bike"
android:layout_gravity="center_vertical"
android:src="#drawable/b3"
android:background="#android:color/transparent"
android:onClick="on_Bbike"
android:layout_above="#+id/exit"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="ENTRY "
android:id="#+id/textView"
android:textColor="#8dacbe"
android:textStyle="bold"
android:textSize="35dp"
android:layout_above="#+id/car"
android:layout_toLeftOf="#+id/textView6"
android:layout_toStartOf="#+id/textView6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bike_count"
android:text="90"
android:textColor="#140441"
android:textSize="30dp"
android:textStyle="bold|italic"
android:layout_alignBottom="#+id/bike"
android:layout_toLeftOf="#+id/exit"
android:layout_toStartOf="#+id/exit"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/car_count"
android:text="120"
android:textStyle="bold|italic"
android:textColor="#140441"
android:textSize="30dp"
android:layout_alignBottom="#+id/car"
android:layout_alignRight="#+id/bike_count"
android:layout_alignEnd="#+id/bike_count" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView5"
android:visibility="invisible"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/T_areadis"
android:hint="Parking area id and name"
android:textColor="#8dacbe"
android:text="kharghar"
android:textSize="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="PAGE"
android:id="#+id/textView6"
android:textColor="#005384"
android:textSize="40dp"
android:textAlignment="center"
android:fontFamily="#string/abc_action_bar_home_description"
android:textStyle="bold"
android:layout_alignTop="#+id/textView"
android:layout_toRightOf="#+id/car_count"
android:layout_toEndOf="#+id/car_count" />
</RelativeLayout>
Please kindly help me out.
Large screen devices use xxhdpi.
How to has equal width
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/exit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bexit"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ENTRY "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#8dacbe"
android:textSize="35dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/home0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bhome0"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/bike_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="90"
android:textColor="#140441"
android:textSize="30dp"
android:textStyle="bold|italic" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/car"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bcar"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/car_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="120"
android:textColor="#140441"
android:textSize="30dp"
android:textStyle="bold|italic" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<ImageButton
android:id="#+id/bike"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:onClick="on_Bbike"
android:src="#drawable/icon_login" />
<TextView
android:id="#+id/T_areadis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Parking area id and name"
android:text="kharghar"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#8dacbe"
android:textSize="30dp" />
</LinearLayout>

When editing text in editext it loses its focus and the keyboard show out so fast

My code works fine before I changed my layout from relative into linear layout in my xm file.What could be the cause of this? How can i fix this? I already tried some of I have researched here but nothing worked.Some says there something to put on manifest but it didn't work for me.Can you please help me out of this.
useritemdetail.xml
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/Item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:text="Item"
android:textSize="15dp" />
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Item"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:textSize="15sp" />
<TextView
android:id="#+id/Quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/label"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:text="Quantity"
android:textSize="15dp" />
<EditText
android:id="#+id/inputQty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Quantity"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:inputType="number"
android:textSize="12sp" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/uom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/inputQty"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:text="UOM"
android:textSize="15dp" />
<Spinner
android:id="#+id/inputUom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/uom"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
/>
<TextView
android:id="#+id/Amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/inputUom"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:text="Amount"
android:textSize="15dp" />
<TextView
android:id="#+id/inputAmt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Amount"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:inputType="number"
android:textSize="12sp" />
<TextView
android:id="#+id/TotalAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/inputAmt"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:text="Total Amount"
android:textSize="15dp" />
<TextView
android:id="#+id/inputTamt"
android:layout_width="50dp"
android:layout_height="35dp"
android:layout_below="#+id/TotalAmount"
android:layout_marginTop="15sp"
android:layout_marginLeft="20sp"
android:textSize="12sp" />
</LinearLayout>

Android relative layout doesn't scroll

I have a relative layout in my xml file inside which I have another relative layout which has all my content. My Inner relative layout is loaded with content that comes from my database.
Also I have a edittext and button at bottom for adding comments.
Now the problem is that my inner relative layout doesn't scroll when the content is more but all the contents get hidden inside the bottom edit text and button.
Here is my xml.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/BG"
android:paddingTop="10dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#FFFFFF"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingBottom="15dp"
android:scrollbars="vertical" >
<TextView
android:id="#+id/discTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"
android:text="Title"
android:textColor="#77d3f1"
android:textSize="18sp" />
<TextView
android:id="#+id/discCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/discTitle"
android:layout_below="#+id/discTitle"
android:layout_marginTop="20dp"
android:text="Category"
android:textColor="#77d3f1"
android:textSize="14sp" />
<TextView
android:id="#+id/discDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/discCategory"
android:layout_below="#+id/discCategory"
android:layout_marginTop="20dp"
android:text="Decsription"
android:textColor="#908484"
android:textSize="16sp" />
<TextView
android:id="#+id/discTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/discDescription"
android:layout_below="#+id/discDescription"
android:layout_marginTop="20dp"
android:text="yyyy mm dd hh:mm:ss"
android:textSize="10sp" />
</RelativeLayout>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginRight="60dp"
android:background="#drawable/commentbg"
android:ems="10"
android:hint="Type a comment..."
android:inputType="textMultiLine"
android:minHeight="40dp"
android:paddingLeft="10dp"
android:textStyle="italic" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="61dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#drawable/commentbg"
android:minHeight="40dp"
android:text="Send" />
</RelativeLayout>
Now I want the inner relative layout’s height to occupy the whole screen and has to be
scrollable when content is more.Have a look at the image below.
Thanks in advance.
Wrap it in ScrollView
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/scroll_view_layout">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#FFFFFF"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingBottom="15dp"
android:scrollbars="vertical" >
<TextView
android:id="#+id/discTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"
android:text="Title"
android:textColor="#77d3f1"
android:textSize="18sp" />
<TextView
android:id="#+id/discCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/discTitle"
android:layout_below="#+id/discTitle"
android:layout_marginTop="20dp"
android:text="Category"
android:textColor="#77d3f1"
android:textSize="14sp" />
<TextView
android:id="#+id/discDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/discCategory"
android:layout_below="#+id/discCategory"
android:layout_marginTop="20dp"
android:text="Decsription"
android:textColor="#908484"
android:textSize="16sp" />
<TextView
android:id="#+id/discTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="#+id/discDescription"
android:layout_below="#+id/discDescription"
android:layout_marginTop="20dp"
android:text="yyyy mm dd hh:mm:ss"
android:textSize="10sp" />
</RelativeLayout>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginRight="60dp"
android:background="#drawable/commentbg"
android:ems="10"
android:hint="Type a comment..."
android:inputType="textMultiLine"
android:minHeight="40dp"
android:paddingLeft="10dp"
android:textStyle="italic" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="61dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#drawable/commentbg"
android:minHeight="40dp"
android:text="Send" />
</RelativeLayout>
</ScrollView>
To scroll content you need to add ScrollView. ScrollView will be parent of the layout that you want to scroll.
http://developer.android.com/reference/android/widget/ScrollView.html

Textview overflow

I have a layout which has and ImageView to the left, and TextView to the right:
<ImageView
android:src="#drawable/alert"
android:id="#+id/articleStoryImage"
android:layout_below="#+id/articleStorySubTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
/>
<TextView
android:id="#+id/articleStory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/articleStorySubTitle"
android:layout_toRightOf="#+id/articleStoryImage"
android:gravity="right"
android:inputType="textMultiLine"
android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
android:ellipsize="end"
android:layout_marginTop="10sp"
android:textSize="11sp"
android:textColor="#000000" />
What I'm trying to do, is that the TextView text would start to the right of the ImageView,
but would continue below the ImageView. You can call it some kind of overflow.
How can I do that?
Thanks.
EDITED: FULL XML:
<?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:background="#FFFFFF"
android:orientation="horizontal" >
<TextView
android:id="#+id/articleStoryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb"
android:typeface="sans"
android:gravity="right"
android:ellipsize="end"
android:singleLine="false"
android:inputType="textMultiLine"
android:textSize="25sp"
android:textColor="#DBA118"
android:textStyle="bold" />
<TextView
android:id="#+id/articleStorySubTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/articleStoryTitle"
android:gravity="right"
android:inputType="textMultiLine"
android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb"
android:ellipsize="end"
android:layout_marginTop="10sp"
android:textSize="12sp"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:src="#drawable/alert"
android:id="#+id/articleStoryImage"
android:layout_below="#+id/articleStorySubTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
/>
<TextView
android:id="#+id/articleStory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/articleStorySubTitle"
android:layout_toRightOf="#+id/articleStoryImage"
android:gravity="right"
android:inputType="textMultiLine"
android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
android:ellipsize="end"
android:layout_marginTop="10sp"
android:textSize="11sp"
android:textColor="#000000" />
</RelativeLayout>
I know you may get better solution but you can ckeck this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tv"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_alignBottom="#+id/ImageView011"
android:layout_marginTop="22dp"
android:text="hi every body hi every body hi everybodyend"
android:textSize="20dp" />
<ImageView
android:id="#+id/ImageView011"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="22dp"
android:layout_marginLeft="22dp"
android:background="#drawable/imag" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="350dp"
android:layout_alignParentBottom="true"
android:text=" TextView TextView TextView TextView TextView"
android:textSize="20dp" />
</RelativeLayout>
also check this link : http://dev.androidteam.ru/snippets/textview/leadingmarginspan2

Resources