确定应该切断哪个textview

时间:2013-08-22 09:59:18

标签: android textview relativelayout

在relativelayout中我使用下面的代码。如果总宽度太高tvProgress应该被切断。问题是我不知道如何确定应该切断哪个视图。当前代码允许list_lib_episodes_watched_total切断。如何确定tvProgress被切断?

...
<TextView
    android:id="@+id/tvProgress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/list_lib_et_episodes_watched"
    android:layout_toRightOf="@+id/list_lib_cover"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:lines="1"
    android:singleLine="true"
    android:text="Progress:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/list_lib_et_episodes_watched"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/list_lib_status_spinner"
    android:layout_toRightOf="@+id/tvProgress"
    android:hint="0"
    android:imeOptions="actionSend"
    android:inputType="number"
    android:maxEms="4"
    android:maxLength="4"
    android:text="0" />

<TextView
    android:id="@+id/list_lib_episodes_watched_total"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/list_lib_et_episodes_watched"
    android:layout_toLeftOf="@+id/list_lib_episodes_watched_increase"
    android:layout_toRightOf="@+id/list_lib_et_episodes_watched"
    android:lines="1"
    android:singleLine="true"
    android:text="/0"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#707070" />

<ImageButton
    android:id="@+id/list_lib_episodes_watched_increase"
    android:layout_width="30dp"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/list_lib_et_episodes_watched"
    android:layout_alignParentRight="true"
    android:layout_alignTop="@+id/list_lib_et_episodes_watched"
    android:layout_marginLeft="6dp"
    android:layout_marginRight="8dp"
    android:adjustViewBounds="true"
    android:background="@drawable/btn_transparant"
    android:contentDescription="Increase by 1"
    android:minWidth="60dp"
    android:scaleType="centerInside"
    android:src="@drawable/ic_increase" />
...

1 个答案:

答案 0 :(得分:0)

为什么要削减任何视图?它是wrap_content所以你无法确定那样。把一切都放进去。然后什么都不会被削减。你可以滚动查看所有内容。

ScrollView是这样的:

   <ScrollView
    android:id="@+id/SCROLLER_ID"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:scrollbars="vertical"
    android:fillViewport="true">

---
---
---

</ScrollView>