我有一个显示客户信息的 UI。我遇到的问题是一些客户名称(android:id="@+id/customerName")很长,不适合文本视图。除了为名称提供完整布局宽度或从其旁边删除代码 textview 的选项(如 xml 文件 android:id="@+id/customerName" 中所示)之外,我还有什么选项可以显示它们。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow>
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/customerCode" />
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/customerName" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/customerCode"
style="@style/CustomerTextView"
android:gravity="right" />
<TextView
android:id="@+id/customerName"
style="@style/CustomerTextView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="right"
android:maxEms="5" />
</TableRow>
<TableRow android:gravity="right" >
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/customerAddress" />
</TableRow>
<TableRow android:gravity="right" >
<TextView
android:id="@+id/customerAddress"
style="@style/CustomerTextView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="right"
android:maxEms="5"
/>
</TableRow>
<TableRow>
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/POBox" />
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/OrganizationName" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/poBox"
style="@style/CustomerTextView"
android:gravity="right" />
<TextView
android:id="@+id/organizationName"
style="@style/CustomerTextView"
android:gravity="right" />
</TableRow>
<TableRow>
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/fax" />
<TextView
style="@style/CustomerLabelTextView"
android:gravity="right"
android:text="@string/phone" />
</TableRow>
=====================================风格++++++++++++++++++++++++++++++++++++++++
<style name="CustomerTextView">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:layout_margin">5dp</item>
<item name="android:background">@drawable/textview_border</item>