いくつかの数字を表示するアプリウィジェットを作成しています。各数字の前にラベルが付いています。
レイアウトは次のようになります。
.-----------------------------.
| Label1 | AAAAAAAAAAA |
| LongerLabelLabel2 | BBBBBBB |
| LongLabel3 | CCCCCCCCCC |
'-----------------------------'
外側(垂直)のLinearLayoutが1つあり、各行は2つのTextViewを持つ水平のLinearLayoutです。
問題は、ラベルの幅と数字がウィジェットに対して広すぎる場合、数字が省略されることです。ラベルを楕円形にしたい。
たとえば、上記の状況は次のようになります。
.-----------------------------.
| Label1 | AAAAAAAAAAA |
| LongerLabelLabel2 | BBBB... |
| LongLabel3 | CCCCCCCCCC |
'-----------------------------'
希望の代わりに
.---------------------------.
| Label1 | AAAAAAAAAAA |
| LongerLabelL... | BBBBBBB |
| LongLabel3 | CCCCCCCCCC |
'---------------------------'
私は私の人生のためにこれを解決する方法を理解することはできません。どんな助けでも大歓迎です。
私の現在のレイアウトは次のとおりです。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:orientation="vertical"
style="@style/WidgetBackground">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ROW1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="7dip"
android:paddingBottom="0dip"
android:paddingRight="10dip"
android:paddingLeft="10dip"
android:orientation="horizontal">
<TextView android:id="@+id/NAME1" android:singleLine="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" style="@style/Text.account" />
<TextView android:id="@+id/BAL1" android:singleLine="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" style="@style/Text.balance" />
</LinearLayout>
... (more similar rows in the outer layout)
</LinearLayout>