【问题标题】:When Text is bigger at that time text is Cuts off?当文本更大时,文本被截断?
【发布时间】:2014-09-11 09:44:20
【问题描述】:
<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/listitem_contact"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingBottom="14dp"
        android:paddingLeft="8dp"
        android:paddingRight="8dp"
        android:paddingTop="14dp">
        <TextView
            android:id="@+id/textview1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginRight="10dp"
            android:layout_weight="1"
            android:text="abcdefghijklm, Miss abcdefghi"
            android:gravity="left|center_vertical"/>
        <ImageView
            android:id="@+id/imageview1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:src="@drawable/ic_map"
            android:background="@drawable/list_item_image_color"/>
        <ImageView
            android:id="@+id/imageview2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:src="@drawable/ic_textmessage"
            android:background="@drawable/list_item_image_color"/>
        <ImageView
            android:id="@+id/imageview3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_phone"
            android:background="@drawable/list_item_image_color"/>
    </LinearLayout>

这里当text为abcdefghijklm时,当时Textview中的abcdefghi小姐Text cutsOff我只用LinearLayout。

有人可以帮我在需要更改的地方吗?

【问题讨论】:

  • 删除android:layout_weight并检查。
  • 是的,但对于所有屏幕,它不像平板电脑和所有设备那样工作..
  • 您介意展示一下屏幕截图吗?
  • 我没有 10 个声誉,因此无法附加文档。
  • 把它贴在别处并在此处提供链接。

标签: android android-layout android-linearlayout android-screen-support android-layout-weight


【解决方案1】:

尝试垂直方向和 wrap_content。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/listitem_contact"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="14dp"
    android:paddingLeft="8dp"
    android:paddingRight="8dp"
    android:paddingTop="14dp">
    <TextView
        android:id="@+id/textview1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:layout_weight="1"
        android:text="abcdefghijklm, Miss abcdefghi"
        android:gravity="left|center_vertical"/>
    <ImageView
        android:id="@+id/imageview1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:src="@drawable/ic_map"
        android:background="@drawable/list_item_image_color"/>
    <ImageView
        android:id="@+id/imageview2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:src="@drawable/ic_textmessage"
        android:background="@drawable/list_item_image_color"/>
    <ImageView
        android:id="@+id/imageview3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_phone"
        android:background="@drawable/list_item_image_color"/>
</LinearLayout>

【讨论】:

  • 这是 Listview 的一行,不可能 layout_width ="wrap_content" and weight = 1 并且必须在水平方向
  • 任何人请帮我解决这个布局我将如何进行?
  • 你能发布你想要的视图图像吗?
  • 我没有10分所以无法上传图片抱歉
猜你喜欢
  • 2013-05-26
  • 1970-01-01
  • 1970-01-01
  • 2018-03-23
  • 2021-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多