10英寸平板电脑preference菜单 [英] Preference Menu on 10 inch tablet

查看:175
本文介绍了10英寸平板电脑preference菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,为什么我的preference菜单的布局在横向模式下使用时,它显示在一个错误的方式10平板电脑弄清楚。这看起来是对复选框的右侧的线实际上是他们的左侧。你可以看到这个在这里 http://imageshack.us/photo/my-images /109/schnappschuss2013052109.png/

在7'平板电脑,一切就像预料之中的事。

我的菜单看起来像:

 <?XML版本=1.0编码=UTF-8&GT?;
< preferenceScreen的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
< preferenceCategory
        机器人:标题=@字符串/ pref_message
        机器人:关键=pref_key_message_settings>
        <复选框preference
            机器人:关键=pref_key_add_timestamp
            机器人:总结=@字符串/ pref_summary_addTimestamp
            机器人:标题=@字符串/ pref_addTimestamp
            机器人:设置defaultValue =真/>
        <名单preference
            机器人:依赖=pref_key_add_timestamp
            机器人:总结=@字符串/ pref_summary_timestamp_option
            机器人:关键=pref_key_timestamp_option
            机器人:标题=@字符串/ pref_timestampOption
            机器人:DIALOGTITLE =@字符串/ pref_timestampOptionDialog
            机器人:项=@阵列/ pref_timestampArray
            机器人:entryValues​​ =@阵列/ pref_timestampValues​​
            机器人:设置defaultValue =时代/>
        <复选框preference
            机器人:关键=pref_key_add_newline
            机器人:总结=@字符串/ pref_summary_addNewLine
            机器人:标题=@字符串/ pref_addNewLine
            机器人:设置defaultValue =真/>
        <名单preference
            机器人:依赖=pref_key_add_newline
            机器人:关键=pref_key_newline_option
            机器人:总结=@字符串/ pref_summary_newline_option
            机器人:标题=@字符串/ pref_newLineOption
            机器人:DIALOGTITLE =@字符串/ pref_newLineOptionDialog
            机器人:项=@阵列/ pref_newLineArray
            机器人:entryValues​​ =@阵列/ pref_newLineValues​​
            机器人:设置defaultValue =LF/>
        <复选框preference
            机器人:关键=pref_key_clear_text
            机器人:总结=@字符串/ pref_summary_clearText
            机器人:标题=@字符串/ pref_clearText
            机器人:设置defaultValue =FALSE/>
    < / preferenceCategory>
 < preferenceCategory
        机器人:标题=@字符串/ pref_storage
        机器人:关键=pref_key_storage_settings>
        < EditText上preference
            机器人:关键=pref_key_change_name
            机器人:总结=@字符串/ pref_summary_editFilename
            机器人:标题=@字符串/ pref_editFilename
            机器人:设置defaultValue =历史/>
        <复选框preference
            机器人:关键=pref_key_add_date
            机器人:总结=@字符串/ pref_summary_addDate
            机器人:标题=@字符串/ pref_addDate
            机器人:设置defaultValue =真/>
        <复选框preference
            机器人:关键=pref_key_add_time
            机器人:总结=@字符串/ pref_summary_addTime
            机器人:标题=@字符串/ pref_addTime
            机器人:设置defaultValue =真/>
       < at.rtcmanager.Confirm preference
           机器人:关键=pref_key_clear_history
            机器人:总结=@字符串/ pref_summary_clearHistory
            机器人:标题=@字符串/ pref_clearHistory/>
< / preferenceCategory>
< preferenceCategory
        机器人:标题=@字符串/ pref_time
        机器人:关键=pref_key_time_settings>
        <复选框preference
            机器人:关键=pref_key_autosend_time
            机器人:总结=@字符串/ pref_summary_austosendTime
            机器人:标题=@字符串/ pref_autosendTime
            机器人:设置defaultValue =FALSE/>
        <名单preference
            机器人:关键=pref_key_mode_sentTime
            机器人:标题=@字符串/ pref_mode_sentTime
            机器人:总结=@字符串/ pref_summary_mode_sentTime
            机器人:DIALOGTITLE =@字符串/ pref_modeSentTimeDialog
            机器人:项=@阵列/ pref_sentTimeModeArray
            机器人:entryValues​​ =@阵列/ pref_sentTimeValues​​
            机器人:设置defaultValue =10Byte/>
< / preferenceCategory>
< preferenceCategory
        机器人:标题=@字符串/ pref_about
        机器人:关键=pref_key_settings_about>
        < preference机器人:标题=@字符串/ prefs_about_app>
            <意向机器人:行动=AboutActivity/>
        < / preference>< / preferenceCategory>
< / preferenceScreen>

和被loded有:

  @覆盖
    公共无效的onCreate(捆绑savedInstanceState){
        super.onCreate(savedInstanceState);        //显示操作栏中的向上按钮。
        getActionBar()setDisplayHomeAsUpEnabled(真)。        //显示片断为主要内容。
        getFragmentManager()调用BeginTransaction()
                .replace(android.R.id.content,新SettingsMenuFragment())
                。承诺();    }    公共静态类SettingsMenuFragment扩展$ P $ {pferenceFragment
        @覆盖
        公共无效的onCreate(捆绑savedInstanceState){
            super.onCreate(savedInstanceState);            //从XML资源负载的preferences
            加preferencesFromResource(R.xml.app_ preFS);        }    }


解决方案

我有同样的问题。我的解决办法是延长 SettingsActivity 从通常的活动,不是从 preferenceActivity 。但 SettingsFragment 应扩大当然 preferenceFragment 。它帮助我,希望这也可以解决您的问题。

I am trying to figure out why the layout of my Preference menu is displayed in a false way on 10' tablets when using it in landscape mode. It looks like the lines that are to the right of the Checkboxes are actually to the left of them. You can see this here http://imageshack.us/photo/my-images/109/schnappschuss2013052109.png/

On 7' tablets, everything works like expected to do.

My menu looks like that:

    <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory 
        android:title="@string/pref_message"
        android:key="pref_key_message_settings">
        <CheckBoxPreference
            android:key="pref_key_add_timestamp"
            android:summary="@string/pref_summary_addTimestamp"
            android:title="@string/pref_addTimestamp"
            android:defaultValue="true"/>
        <ListPreference
            android:dependency="pref_key_add_timestamp"
            android:summary="@string/pref_summary_timestamp_option"
            android:key="pref_key_timestamp_option"
            android:title="@string/pref_timestampOption"
            android:dialogTitle="@string/pref_timestampOptionDialog"
            android:entries="@array/pref_timestampArray"
            android:entryValues="@array/pref_timestampValues"
            android:defaultValue="Time" />
        <CheckBoxPreference
            android:key="pref_key_add_newline"
            android:summary="@string/pref_summary_addNewLine"
            android:title="@string/pref_addNewLine"
            android:defaultValue="true"/>
        <ListPreference
            android:dependency="pref_key_add_newline"
            android:key="pref_key_newline_option"
            android:summary="@string/pref_summary_newline_option"
            android:title="@string/pref_newLineOption"
            android:dialogTitle="@string/pref_newLineOptionDialog"
            android:entries="@array/pref_newLineArray"
            android:entryValues="@array/pref_newLineValues"
            android:defaultValue="LF" />
        <CheckBoxPreference
            android:key="pref_key_clear_text"
            android:summary="@string/pref_summary_clearText"
            android:title="@string/pref_clearText"
            android:defaultValue="false"/>
    </PreferenceCategory>
 <PreferenceCategory 
        android:title="@string/pref_storage"
        android:key="pref_key_storage_settings">
        <EditTextPreference
            android:key="pref_key_change_name"
            android:summary="@string/pref_summary_editFilename"
            android:title="@string/pref_editFilename"
            android:defaultValue="history"/>
        <CheckBoxPreference
            android:key="pref_key_add_date"
            android:summary="@string/pref_summary_addDate"
            android:title="@string/pref_addDate"
            android:defaultValue="true"/>
        <CheckBoxPreference
            android:key="pref_key_add_time"
            android:summary="@string/pref_summary_addTime"
            android:title="@string/pref_addTime"
            android:defaultValue="true"/>     
       <at.rtcmanager.ConfirmPreference
           android:key="pref_key_clear_history"
            android:summary="@string/pref_summary_clearHistory"
            android:title="@string/pref_clearHistory"/>
</PreferenceCategory>
<PreferenceCategory 
        android:title="@string/pref_time"
        android:key="pref_key_time_settings">  
        <CheckBoxPreference
            android:key="pref_key_autosend_time"
            android:summary="@string/pref_summary_austosendTime"
            android:title="@string/pref_autosendTime"
            android:defaultValue="false"/>
        <ListPreference
            android:key="pref_key_mode_sentTime"
            android:title="@string/pref_mode_sentTime"
            android:summary="@string/pref_summary_mode_sentTime"
            android:dialogTitle="@string/pref_modeSentTimeDialog"
            android:entries="@array/pref_sentTimeModeArray"
            android:entryValues="@array/pref_sentTimeValues"
            android:defaultValue="10Byte" />
</PreferenceCategory> 
<PreferenceCategory 
        android:title="@string/pref_about"
        android:key="pref_key_settings_about">  
        <Preference android:title="@string/prefs_about_app" >
            <intent android:action="AboutActivity"/>
        </Preference>

</PreferenceCategory>  
</PreferenceScreen>

and is loded with:

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Show the Up button in the action bar.
        getActionBar().setDisplayHomeAsUpEnabled(true);

        // Display the fragment as the main content.
        getFragmentManager().beginTransaction()
                .replace(android.R.id.content, new SettingsMenuFragment())
                .commit();



    }

    public static class SettingsMenuFragment extends PreferenceFragment {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            // Load the preferences from an XML resource
            addPreferencesFromResource(R.xml.app_prefs);

        }

    }

解决方案

I had the same problem. My solution is to extend SettingsActivity from usual Activity, not from PreferenceActivity. But SettingsFragment should extend PreferenceFragment of course. It helped me, hope this solves your issue too.

这篇关于10英寸平板电脑preference菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆