1

設定アクティビティは、呼び出しによって膨らみます

addPreferencesFromResource(R.xml.preferences);

そして、ここにpreferences.xmlがあります:

<PreferenceCategory android:title="@string/pref_categ_update_label">
    <ListPreference android:title="@string/pref_label"
        android:key="update_interval" 
        android:entries="@array/update_names" android:entryValues="@array/update_values" />


</PreferenceCategory>


<PreferenceCategory android:title="@string/pref_categ_evernote_label">

    <EditTextPreference android:title="@string/pref_dialog_edit_username"
        android:key="prefUsername" 
        android:positiveButtonText="@string/save_pref"
        android:negativeButtonText="@string/cancel_pref"  />

    <EditTextPreference android:title="@string/pref_dialog_edit_password"
        android:key="prefPassword"  
        android:positiveButtonText="@string/save_pref"
        android:negativeButtonText="@string/cancel_pref"             
        android:password="true" />

</PreferenceCategory>

すべて問題ないように見えますが、ListPreference (1) と同様に、EditTextPreference エントリ (2 と 3) の横に下矢印アイコンがあります。これらのアイコンは無関係に見えるので、どうすれば削除できますか?

スクリーンショットはこちら: http://i.stack.imgur.com/BZUr7.png

4

4 に答える 4

4

設定に矢印が必要ない場合は、-を使用してください

**android:widgetLayout="@null"**

また、右側にカスタム画像を優先的に表示する場合は、-を使用します。

**android:widgetLayout="@layout/pref_custom_image"**

ここで、pref_custom_image.xmlは次のようになります-

<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>
于 2012-06-22T11:15:18.680 に答える
0

矢印は、その設定をクリックすると別の場所に移動することを知らせるためにあります. の場合はListPreference別の「画面」に移動するEditTextPreferenceことを示し、 の場合はダイアログをポップアップすることを示します。気に入らない場合は、新しいスタイルを作成して代わりに使用できます。

于 2010-09-29T13:48:34.757 に答える
0

これが安全で良い方法かどうかは 100% わかりませんが、次のように EditTextPreference クラスを拡張すると、アイコンを削除できます。

メソッドをオーバーライドするgetView()ことで、リストに描画されるものを変更できます。元のビューを使用して、すべての画像を (再帰的に) 検索し、それらvisibilityを に変更していGONEます。

public class EditTextPreferenceNoImage extends EditTextPreference {
public EditTextPreferenceNoImage(Context context, AttributeSet attrs,
        int defStyle) {
    super(context, attrs, defStyle);
}

public EditTextPreferenceNoImage(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public EditTextPreferenceNoImage(Context context) {
    super(context);
}

@Override
public View getView(View convertView, ViewGroup parent) {
    View view = super.getView(convertView, parent);
    changeImagesVisibility(view, View.GONE);
    return view;
}

private void changeImagesVisibility(View view, int visibility) {
    log.debug("child:" + view.getClass());
    if (view instanceof ViewGroup) {
        ViewGroup ll = (ViewGroup) view;
        for (int i = 0; i < ll.getChildCount(); i++) {
            changeImagesVisibilitz(ll.getChildAt(i), visibility);
        }
    } else if (view instanceof ImageView) {
        log.debug("visiblitz : " + (visibility == View.VISIBLE));
        ImageView image = (ImageView) view;
        image.setVisibility(visibility);
    }

}}
于 2011-11-30T18:20:16.153 に答える
0

誰かがこの同じ問題を抱えている場合は、設定項目の矢印を取り除くための非常に簡単な解決策を見つけました (技術的には、そこに表示されるものはすべて取り除きます-矢印の画像チェックボックスなど)。Preferences.xml で、Widget Layout の値を「@null」に設定します。

于 2012-06-04T18:58:06.613 に答える