简体   繁体   English

Android用FlowTextView包裹文字会覆盖TextView

[英]Android wrapping text with FlowTextView is overwriting TextView

I searched StackOverflow for a solution to wrap text around an image and found links to FlowTextView with I have implemented but I am having an issue with it overwriting normal TextViews and the positioning of those TextViews. 我在StackOverflow上搜索了一种将文本环绕在图像上的解决方案,并找到了我已经实现的指向FlowTextView的链接,但是它覆盖了正常的TextView和这些TextView的位置时遇到了问题。 I did have them constrained to the end of the image but as that has now moved out of the layout I can no longer do that. 我确实将它们限制在图像的末尾,但是由于现在已经移出了版面,所以我不能再这样做了。

I want to get the FlowTextView to start where the 4th long TextView shows across the image and the TextViews to be to the right of the ImageView Can any help? 我想让FlowTextView在图像上显示第4个长的TextView的地方开始,而TextViews在ImageView的右边。有什么帮助吗?

文本换行

    <?xml version="1.0" encoding="utf-8"?>
    <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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="8dp"
    app:cardCornerRadius="8dp" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="8dp">

        <uk.co.deanwild.flowtextview.FlowTextView
            android:id="@+id/ftv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/imageView_room"
                android:layout_width="200dp"
                android:layout_height="160dp"
                android:contentDescription="@string/room_image"
                android:padding="4dp" />

        </uk.co.deanwild.flowtextview.FlowTextView>

        <TextView
            android:id="@+id/textview_room_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignEnd="@+id/ftv"
            android:layout_marginStart="25dp"
            android:layout_marginEnd="29dp"
            android:text="@string/living_room"
            android:textSize="18sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/textview_length"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/textview_room_name"
            android:layout_alignStart="@+id/ftv"
            android:layout_marginStart="25dp"
            android:layout_marginTop="10dp"
            android:text="@string/length_12_x_6"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/textview_width"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/textview_length"
            android:layout_alignStart="@+id/ftv"
            android:layout_marginStart="24dp"
            android:layout_marginTop="5dp"
            android:text="@string/width_10_x_8" />

        <TextView
            android:id="@+id/textview_desc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textview_width"
            android:layout_alignStart="@+id/ftv"
            android:layout_marginStart="25dp"
            android:layout_marginTop="10dp"                                                                               android:text="@string/with_a_large_window_looking_onto_the_vast_garden" />

    </RelativeLayout>

</android.support.v7.widget.CardView>

You need to use android:layout_toEndOf="@+id/ftv" . 您需要使用android:layout_toEndOf="@+id/ftv" layout_alignEnd puts the end of both the views together instead of start to end. layout_alignEnd将两个视图的末尾放在一起,而不是layout_alignEnd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM