我如何环绕第一个文本标题第二个文本,无论是在文本视图 [英] How do I wrap a second text around first text title, both are in text view

查看:165
本文介绍了我如何环绕第一个文本标题第二个文本,无论是在文本视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图环绕第一个文本第二个文本,无论是在相对布局和TextView的这样:

I am trying to wrap a second text around the first text, both in relative layout and textview such that :

<RelativeLayout
        android:id="@+id/headlineRelativeLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/text1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="2dp"
            android:paddingRight="2dp"
            foo:customFont="proxima-nova-bold.ttf"
            android:textColor="@color/orange"
            android:textSize="@dimen/title" 
            android:gravity="left"
        />

        <TextView
            android:id="@+id/text2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLines="2"
            android:paddingLeft="2dp"
            android:paddingRight="2dp"
            android:layout_toRightOf="@id/text1"
            foo:customFont="proxima-nova-regular.ttf"
            android:textColor="@color/green"
            android:textSize="@dimen/title"
            android:gravity="left"
             />

    </RelativeLayout>

那么,是什么我目前得到的是:

So, what I am currently getting is :

TEXT1 (TEXT 2 STUFF IS A SENTENCE WHICH
       SHOULD WRAP AROUND)

但我想到的是:

TEXT1 (TEXT 2 STUFF IS A SENTENCE WHICH
WHICH SHOULD WRAP AROUND)

任何线索?

推荐答案

我可以在这里错过了一些东西,但你重新得到是我期望的那样。每个的TextView 是一个矩形框到其中的文本呈现。如果你愿意,你可以覆盖的箱子,但随后的TEXT 1和TEXT 2就趴在彼此顶部。

I may have missed something here, but what you re getting is what I would expect. Each TextView is a rectangular box into which the text is rendered. If you want, you can overlay the boxes, but then the 'TEXT 1' and 'TEXT 2' would lie on top of each other.

要实现你想要的,你将不得不更仔细的思考,你在做什么想,也许有三个 TextViews 取值:

To achieve what you want, you will have to think more carefully about what you are doing, and perhaps have three TextViewss:

<TextView 1><TextView 2>
<..... TextView 3 .....>

每当你的TextView 2设置文本,将其设置为只显示一行,并发现它有多远了。那么字符串的其余部分发送到TextView的3。

Whenever you set the text in TextView 2, set it to only show one line and find out how far it got. Then send the rest of the string to TextView 3.

这篇关于我如何环绕第一个文本标题第二个文本,无论是在文本视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆