我已正确设置pref_general,其值以及运行intent的代码:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
Intent intecao = new Intent(characterList.this, SettingsActivity.class);
startActivity(intecao);
return true;
}
return super.onOptionsItemSelected(item);
}
因此,如果我点击选项弹出窗口中的设置,它将在我的手机中正确打开/ 7"平板电脑,但对于更大的平板电脑,如9"或者更多它会给我一个空白的屏幕弹出窗口,而不会写任何内容,例如:
如何解决此问题?导致这种情况发生的问题是什么?
---编辑---
这是我的pref_general:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Made by Megafuji and Kintups"/>
<ListPreference
android:key="console1"
android:title="Console"
android:summary="Select your console"
android:defaultValue="1"
android:entries="@array/pref_example_list_titles"
android:entryValues="@array/pref_example_list_values"
android:negativeButtonText="@null"
android:positiveButtonText="@null" />
<ListPreference
android:key="viewMode"
android:title="View Mode"
android:summary="Select your View Mode"
android:defaultValue="1"
android:entries="@array/pref_viewMode_list_titles"
android:entryValues="@array/pref_viewMode_list_values"
android:negativeButtonText="@null"
android:positiveButtonText="@null" />
<ListPreference
android:key="charsize"
android:title="Icons Size"
android:summary="Select character screen size for text and icons."
android:defaultValue="1"
android:entries="@array/pref_character_size"
android:entryValues="@array/pref_character_size_value"
android:negativeButtonText="@null"
android:positiveButtonText="@null" />
<ListPreference
android:key="tamanhoLetra"
android:title="Font Size"
android:summary="Select font size you want for move list."
android:defaultValue="1"
android:entries="@array/pref_font_size"
android:entryValues="@array/pref_font_size_value"
android:negativeButtonText="@null"
android:positiveButtonText="@null" />
<CheckBoxPreference
android:key="screenDimming"
android:title="Disable screen dimming in this app"
android:summary="Disable screen locking/turning off."
android:defaultValue="false"
/>
<CheckBoxPreference
android:key="frame"
android:title="Show Frame Date"
android:summary="Show Frame Data for All Moves "
android:defaultValue="false"
/>
<CheckBoxPreference
android:key="damage"
android:title="Show Damage"
android:summary="Show Damage for All Moves "
android:defaultValue="false" />
<PreferenceCategory
android:title="Contact us: mkxmoves@gmail.com"/>
</PreferenceScreen>
答案 0 :(得分:4)
找到了答案!
我在Android Developer Settings之后需要做的就是如果我正在为Android 3.0(API级别11)开发,我需要使用Preference Fragments,这是另一个扩展PreferenceFragment的类。
所以代码将使用这些参数:
public static class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
}
...
}
并且旧的SettingsActivity现在必须扩展Activity而不是PreferenceActivity,如下所示:
public class SettingsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
}
}
答案 1 :(得分:1)
NAME time time type type detail
----------------------------------------------
john 10:30AM 10:34AM 1 2 On
john 10:34AM 10:49AM 2 2 break
john 10:49AM 11:12AM 2 3 on
paul 10:35AM 10:55AM 1 3 On
steve 10:32AM 10:45AM 1 3 On
答案 2 :(得分:0)
对于没有实际设置视图元素的平板电脑,您很可能在XML中有设置视图。
有关支持多个视图的详细信息,请参阅Android docs。基本上,自动设置的规则会导致平板电脑的XML视图而不是电话使用。
看起来应该是这样的:
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra-large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra-large in landscape orientation
删除XML文件或更新它以包含所需的设置元素。