3

如何增加(换行到内容)首选项汇总值的大小?

它目前最多显示 105 个字符。

4

1 回答 1

0

通过添加到我的 EditTextPreferences 来解决它:

android:layout="@layout/edit_text_preference_layout"

并将标准 Android 布局 XML 复制到我自己的布局文件 (edit_text_preference_layout.xml) 并进行一些更改(即删除 maxlines 属性并更改字体大小和边距以完全匹配其他首选项(出于某种原因,sdk 中的preferences.xml ( 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" />

所以,如果你有其他偏好——它们的布局也应该改变,所以一切在偏好屏幕上看起来都是一致的。

于 2014-05-06T21:54:18.350 回答