在android xml中端到端添加两个textviews [英] Add two textviews end to end in android xml

查看:25
本文介绍了在android xml中端到端添加两个textviews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在另一个文本视图的末尾添加一个文本视图,即不在下一行,而是在前一个文本视图结束的地方,在 xml 文件中.就像:

I want to add a textview right at the end of another textview, ie not in next line, but where previous textview ends, in xml file. Just like:

| <TextView1><TextView2>    |


| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb    |

我的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="fill_parent"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 
        android:ellipsize="none"/>

    <TextView
        android:id="@+id/date"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="bbb" />

</LinearLayout>

但是没有显示文本bbb".有人可以帮忙吗?

but text "bbb" is not shown. Can anyone help?

推荐答案

很简单,使用一个 textView 并在你的 cod 中使用 append 方法并在你的第二个文本之前添加一些空格:)

it's simple use one textView and inside your cod use append method and add some space before your second text :)

这篇关于在android xml中端到端添加两个textviews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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