0

我有一个奇怪的问题。我想显示可从应用程序中的设置查看的许可证信息。我正在使用一个非常简单的自定义DialogPreference,它只是在里面托管scrollveiw一个textview。一切正常,除了在我运行 android 2.3.5 的测试设备上,对话框非常暗且难以阅读。它在我运行 android > 4.0 的主设备上完美运行。可能是什么问题?

它在 android 2.3.5 上的样子: 在此处输入图像描述

我的 XML:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="7dp"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/info_textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textIsSelectable="false"
        android:layout_margin="7dip" />

</ScrollView>

我的代码:

public class PreferenceDialogOpenSourceLicenses extends DialogPreference {
    private String dialogeMessage;
    private Context context;

    public PreferenceDialogOpenSourceLicenses(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
        setPersistent(false);
        setDialogLayoutResource(R.layout.preference_dialog_license);
        dialogeMessage = getActionBarSherlockLicense();
    }

    @Override
    public void onBindDialogView(View view){
        TextView textView = (TextView)view.findViewById(R.id.info_textview);
        textView.setText(dialogeMessage);
        super.onBindDialogView(view);
    }

    private String getActionBarSherlockLicense() {
         try {
                InputStream is = context.getAssets().open("licence_apache_v2.txt");
                int size = is.available();
                byte[] buffer = new byte[size];
                is.read(buffer);
                is.close();
                String text = new String(buffer);

                return text;
            } catch (IOException e) {
                return context.getString(R.string.error_could_not_get_license);
            }
    }
}
4

1 回答 1

0

看看你的 value 文件夹中的 styles.xml!将其他任何内容放在您的应用主题的父级中......这应该可以解决“黑暗”主题问题;)例如:.Light 主题

之后可以将value-v11文件夹&value-v14文件夹的styles.xml修改为holo,API级别支持时会考虑Holo主题!

于 2013-08-02T20:01:25.917 回答