相关疑难解决方法(0)

是否故意将PreferenceFragment排除在兼容性包之外?

我正在寻找可以应用于3.0和3.0之前的设备的首选项.发现PreferenceActivity包含已弃用的方法(虽然这些方法在随附的示例代码中使用),我查看PreferenceFragement了兼容性包以解决我的困境.

但是,它似乎PreferenceFragment不在兼容包中.谁能告诉我这是否是故意的?如果是这样,我可以轻松定位一系列设备(即<3.0和> = 3.0)还是我必须跳过篮球?如果没有故意排除,我们是否可以期待兼容包的新版本?或者是否有另一种可以安全使用的解决方法?

干杯

詹姆士

compatibility android android-3.0-honeycomb

153
推荐指数
6
解决办法
4万
查看次数

使用android-support-v4替代PreferenceFragment

我突然停止了我的应用程序的开发,因为我意识到这个库中不支持PreferenceFragments.新手Android开发人员可以使用任何替代方案来克服这个障碍吗?

这是我现在的主要窗口

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<TabHost
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="0"/>

        <FrameLayout
            android:id="@+android:id/realtabcontent"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>
    </LinearLayout>

                <TabWidget
            android:id="@android:id/tabs"
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            />

</TabHost>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

对于我的TabActivity,我使用的是我在网上找到的东西.这是一个片段:

public class TabControlActivity extends FragmentActivity implements TabHost.OnTabChangeListener 
{
public static final int INSERT_ID = Menu.FIRST;
public static TabControlActivity thisCtx;
private TabHost mTabHost;
private HashMap mapTabInfo = new HashMap();
private TabInfo mLastTab = null;

private class TabInfo {
     private String …
Run Code Online (Sandbox Code Playgroud)

android android-fragments

90
推荐指数
6
解决办法
5万
查看次数