Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android tabhost事务片段效果_Android_Fragment_Android Tabhost_Effects - Fatal编程技术网

Android tabhost事务片段效果

Android tabhost事务片段效果,android,fragment,android-tabhost,effects,Android,Fragment,Android Tabhost,Effects,是否有可能在tabHost中产生滑动效果? 我的tabHos在这个布局中: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment1" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="matc

是否有可能在tabHost中产生滑动效果? 我的tabHos在这个布局中:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fragment1"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TabHost
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tabHost"
        android:layout_gravity="center_horizontal"
        android:background="@drawable/drawer_shadow">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical">

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

                <LinearLayout
                    android:id="@+id/tab1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="horizontal">
                </LinearLayout>
                <LinearLayout
                    android:id="@+id/tab2"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="horizontal">
                </LinearLayout>
                <LinearLayout
                    android:id="@+id/tab3"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="horizontal">
                </LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </TabHost>
</RelativeLayout>

我不确定在这种情况下是否也可以为视图提供幻灯片效果。我的意思是,当您单击选项卡时,您将在片段事务中看到效果。

我看到了这篇文章,侦听器被调用,但我点击选项卡时看不到任何动画。是否尝试用mTabHost.setontabchangedListener.setontabchangedListener.new ontabchangedListener替换getTabHost.setontabchangedListener新OnTabChangeListener?@NSimon是的,我调试了,但没有看到任何动画。可能是因为我在tabHost中使用了一个片段而不是一个活动?试着启动它怎么样?动画=INFORMORightAnimation;currentView.startAnimationanimation;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    //View rootView = inflater.inflate(R.layout.fragment_student_marks, container, false);

    mTabHost = new FragmentTabHost(getActivity());
    mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.fragment1);
   //

    mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
            FragmentTest.class, null);
    mTabHost.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
            FragmentTest2.class, null);
    mTabHost.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
            FragmentTest.class, null);

    //mTabHost.setOnTabChangedListener(new AnimatedTabHostListener(mTabHost));
    return mTabHost;
}