如何在2个文本视图中分割文本,如果有1个?

Lea*_*ers 6 android listview android-layout

我有一个列表视图,其中每个项目有2个图像,一个在右边,另一个在左边.在它们之间有一个由数据填充的文本视图.如果文本很长,那么它可以继续向下但是有很多可用空间就像你在图像中看到的那样.我也想用这个空间来显示文字.我一直在浏览网页,我看过这样的内容http://code.google.com/p/android-flowtextview/downloads/detail?name=FlowTextDemo.zip&can=2&q=但这没用.我不想失去对图像的控制,因为我需要他们的点击方法.最好的方法是什么?我曾经想过,也许我可以在图像和其他图像之间放置文本视图,当第一个填充时继续在第二个文本视图中但是我怎么能知道有多少个字母可以保留第一个文本视图?在此输入图像描述

Ted*_*opp 5

我不明白为什么FlowTextView(你链接到)不适合你.它源自RelativeLayout并围绕任何子视图流动文本.子视图可以是您的图像,可以像往常一样定位RelativeLayout.他们的onClick方法应该工作得很好.

<com.pagesuite.flowtext.FlowTextView
    android:id="@+id/tv"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/the_text >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:onClick="onTopLeftClick"
        android:src="@drawable/top_left_image" />
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:onClick="onTopRightClick"
        android:src="@drawable/top_right_image" />

</com.pagesuite.flowtext.FlowTextView>
Run Code Online (Sandbox Code Playgroud)

您需要在代码中设置文本,或者扩展FlowTextView并定义您自己的自定义属性以从xml执行此操作.