【发布时间】:2011-08-17 14:12:56
【问题描述】:
如何增加(换行到内容)偏好汇总值的大小?
目前最多显示 105 个字符。
【问题讨论】:
-
事实上,有趣的是,在某些设备(顶级型号)上显示的字符更多,在某些设备(较低分辨率的中间层型号)上显示的字符更少(大约 50 个字符)。也在寻找解决方案。
标签: android preferences summary
如何增加(换行到内容)偏好汇总值的大小?
目前最多显示 105 个字符。
【问题讨论】:
标签: android preferences summary
通过添加到我的 EditTextPreferences 来解决它:
android:layout="@layout/edit_text_preference_layout"
并将标准 Android 布局 XML 复制到我自己的布局文件 (edit_text_preference_layout.xml) 并进行一些更改(即删除 maxlines 属性并更改字体大小和边距以完全匹配其他首选项(出于某种原因,preferences.xml在 sdk(7 和 19)中的值使受影响的首选项看起来与我在屏幕上的标准首选项有点不同):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:orientation="vertical" />
所以,如果您有其他偏好 - 他们的布局也应该改变,所以一切在偏好屏幕上看起来都是一致的。
【讨论】: