小编aro*_*han的帖子

当我从片段滑动到另一个时,如何进行事件

这是我的代码关于在6个片段之间滑动,我想做一个事件,当我从一个片段刷到另一个从加载一些东西,所以请任何帮助我怎么能这样做??? ,,和哪里我可以把代码,我想到进度对话框启动它在函数获取标题并在片段的开头取消它是否适用?这是我的代码:

             package com.example.my_finalswipe;
                 import java.util.List;
                 import java.util.Locale;
            import java.util.Vector;
            import android.os.Bundle;
            import android.support.v4.app.Fragment;
            import android.support.v4.app.FragmentActivity;
            import android.support.v4.app.FragmentManager;
            import android.support.v4.app.FragmentPagerAdapter;
            import android.support.v4.view.ViewPager;
            import android.view.LayoutInflater;
            import android.view.View;
            import android.view.ViewGroup;

             public class MainActivity extends FragmentActivity {


            SectionsPagerAdapter mSectionsPagerAdapter;


            ViewPager mViewPager;
            List<Fragment> fragments ;

            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_main);

                // Create the adapter that will return a fragment for each of the three
                // primary sections of the app.
               fragments = new Vector<Fragment>();

                        fragments.add(Fragment.instantiate(this, FragmentOne.class.getName()));
                        fragments.add(Fragment.instantiate(this, FragmentTwo.class.getName()));
                        fragments.add(Fragment.instantiate(this, FragmentThree.class.getName()));
                        fragments.add(Fragment.instantiate(this, …
Run Code Online (Sandbox Code Playgroud)

java android android-fragments android-viewpager fragmentpageradapter

2
推荐指数
1
解决办法
2822
查看次数