Android的TextView的文本没有得到包裹包裹、文本、Android、TextView

2023-09-12 02:47:23 作者:独往归途

谁能告诉我这是用文字去错了吗?文本长度超过一行不换行到下一行,但超出了屏幕。

以下是code:

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=横向
    机器人:填充=4dip>

    < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直
        机器人:填充=4dip>

        < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=横向
            机器人:填充=4dip>
            <的TextView
                机器人:ID =@ + ID / reviewItemEntityName
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文本=事件/场地
                机器人:文字颜色=@色/栗色
                机器人:单线=真
                机器人:ellipsize =结束
                机器人:TEXTSIZE =14sp
                机器人:TEXTSTYLE =黑体
                机器人:layout_weight =1/>

            < ImageView的
                机器人:ID =@ + ID / reviewItemStarRating
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_alignParentTop =真
                机器人:layout_alignParentBottom =真
                机器人:SRC =@可绘制/ title_1_star/>
        < / LinearLayout中>

        <的TextView
            机器人:ID =@ + ID / reviewItemDescription
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=说明来这里
            机器人:TEXTSIZE =12SP
            机器人:layout_weight =1/>
    < / LinearLayout中>
< / LinearLayout中>
 

解决方案

我固定它自己,关键是机器人:宽=0dip

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT
 机器人:填充=4dip>

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
  机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT
  机器人:方向=垂直机器人:填充=4dip
  机器人:layout_weight =1>

  < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
   机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT
   机器人:方向=横向机器人:填充=4dip>
   < TextView的机器人:ID =@ + ID / reviewItemEntityName
    机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT
    机器人:文字颜色=@色/栗色机器人:单线=真
    机器人:ellipsize =结束机器人:TEXTSIZE =14sp机器人:TEXTSTYLE =黑体
    机器人:layout_weight =1/>

   < ImageView的机器人:ID =@ + ID / reviewItemStarRating
    机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignParentTop =真
    机器人:layout_alignParentBottom =真/>
  < / LinearLayout中>

  < TextView的机器人:ID =@ + ID / reviewItemDescription
   机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT
   机器人:TEXTSIZE =12SP机器人:宽=0dip/>
 < / LinearLayout中>


 < ImageView的机器人:ID =@ + ID / widget01机器人:layout_width =WRAP_CONTENT
  机器人:layout_height =WRAP_CONTENT机器人:SRC =@可绘制/ arrow_nxt
  机器人:layout_gravity =center_vertical机器人:paddingRight =5dip/>

< / LinearLayout中>
 

Android Textview 支持局部点击 ClickableSpan 富文本 解决LinkMovementMethod滑动冲突

Can anyone tell me what's going wrong with the text? Text longer than one line doesn't wrap to the next line but goes beyond the screen.

Following is the code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:padding="4dip">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:padding="4dip">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:orientation="horizontal" 
            android:padding="4dip">
            <TextView 
                android:id="@+id/reviewItemEntityName"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:text="event/venue" 
                android:textColor="@color/maroon"
                android:singleLine="true" 
                android:ellipsize="end" 
                android:textSize="14sp"
                android:textStyle="bold" 
                android:layout_weight="1" />

            <ImageView 
                android:id="@+id/reviewItemStarRating"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_alignParentBottom="true"
                android:src="@drawable/title_1_star" />
        </LinearLayout>

        <TextView 
            android:id="@+id/reviewItemDescription"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:text="Description comes here" 
            android:textSize="12sp" 
            android:layout_weight="1"/>
    </LinearLayout>
</LinearLayout>

解决方案

I fixed it myself, the key is android:width="0dip"

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent" android:layout_height="wrap_content"
 android:padding="4dip">

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content" android:layout_height="wrap_content"
  android:orientation="vertical" android:padding="4dip"
  android:layout_weight="1">

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent" android:layout_height="wrap_content"
   android:orientation="horizontal" android:padding="4dip">
   <TextView android:id="@+id/reviewItemEntityName"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:textColor="@color/maroon" android:singleLine="true"
    android:ellipsize="end" android:textSize="14sp" android:textStyle="bold"
    android:layout_weight="1" />

   <ImageView android:id="@+id/reviewItemStarRating"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true" />
  </LinearLayout>

  <TextView android:id="@+id/reviewItemDescription"
   android:layout_width="fill_parent" android:layout_height="wrap_content"
   android:textSize="12sp" android:width="0dip" />
 </LinearLayout>


 <ImageView android:id="@+id/widget01" android:layout_width="wrap_content"
  android:layout_height="wrap_content" android:src="@drawable/arrow_nxt"
  android:layout_gravity="center_vertical" android:paddingRight="5dip" />

</LinearLayout>