TextView的线 - 咨询 [英] textView lines - advice

查看:118
本文介绍了TextView的线 - 咨询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<RelativeLayout
        android:id="@+id/RelativeLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:adjustViewBounds="true"
            android:src="@drawable/icon" />

        <TextView
            android:id="@+id/fullnameTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/wayimageView"
            android:textColor="@color/list_text_color"
            android:textSize="16dp"
            android:singleLine="false"
             />
    <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:adjustViewBounds="true"
            android:src="@drawable/icon" />
    </RelativeLayout>

我要设置名称ImageView的权利。这是罚款,但有一个问题。如果名字太长它会第二ImageView的下。有没有办法让TextView中的最大行数charachters(如10)时,字符大小为10它会自动转到第二行。

I want set name to right of imageView. It's fine but there is one problem. When the name is too long it's going under the second imageview. Is there a way to give textView's line maximum charachters count (e.g. 10) when the chars size is 10 it's automatically go to second line.

推荐答案

最好的和最简单的方法是设置名字留在第二个图像的左侧。

The best and easiest way is to set the name to stay at the left of the second image.

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="10dp"
    android:adjustViewBounds="true"
    android:src="@drawable/icon" />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentright="true"
    android:layout_marginRight="10dp"
    android:adjustViewBounds="true"
    android:src="@drawable/icon" />

<TextView
    android:id="@+id/fullnameTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@+id/imageView2"
    android:layout_toRightOf="+@id/wayimageView"
    android:textColor="@color/list_text_color"
    android:textSize="16dp" />

这篇关于TextView的线 - 咨询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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