开发者

Having a view wrap around another view

Is there a way to make my textview wrap around other views? For example in the picture, is there a way to get it to wrap to the edge once it gets below the imageview?

Having a view wrap around another view

This is my xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout  
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"  
android:layout_height="fill_parent"  
android:background="@android:color/white">


    <LinearLayout android:id="@+id/AUTHOR_TITLE"
    开发者_JAVA百科    android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"

        android:layout_alignParentTop="True">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20dip"
            android:text="Author Name"
            />

    </LinearLayout>
        <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"

android:layout_height="wrap_content"    
android:layout_below="@id/AUTHOR_TITLE">


            <ImageView android:id="@+id/PICTURE"
            android:layout_alignParentLeft="True"
            android:layout_alignParentTop="True"
            android:src="@drawable/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"  />
                    <TextView android:id="@+id/DESCRIPTION" 
            android:layout_toRightOf="@id/PICTURE"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF OMGTESTLOLWTF
OMGTESTLOLWTF "/>   
        </RelativeLayout>

</RelativeLayout>

I'm really surprised that no one's done this yet =\ Sigh.


This is not currently possible with the built in widgets. You can roll your own, it shouldn't be too hard. You'd need to extend one of the ViewGroup classes and add the images and text to that. Then, in onLayout() you can figure out how to flow the text so that it wraps the images.


Check this library. FlowTextView https://github.com/deano2390/FlowTextView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜