怎樣才能鎖定尋呼viewpager的片段活性片段swipe.I'm在一個fragment.While執行進度使用一些操作進展進度片段得到action.so而progessing進度,因爲刷卡的變化我想停止滑動。如何做到這一點?有沒有解決方案?鎖定頁面片段ViewPager安卓
activity.xml文件 -
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainFragmentActivity" >
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="@drawable/title"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:textColor="#fff" />
</android.support.v4.view.ViewPager>
片段活動 -
public class MainFragmentActivity extends FragmentActivity {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
private Context mContext;
private PagerTitleStrip pt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(),mContext);
mContext=this;
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
pt=(PagerTitleStrip) findViewById(R.id.pager_title_strip);
}
SectionsPagerAdapter-
public class SectionsPagerAdapter extends FragmentPagerAdapter {
Context mContext;
Fragment fragment;
public SectionsPagerAdapter(FragmentManager fm, Context context) {
super(fm);
mContext=context;
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a DummySectionFragment (defined as a static inner class
// below) with the page number as its lone argument.
if(position==0){
fragment = new SelectItem();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, position + 1);
fragment.setArguments(args);
}
if(position==1){
fragment = new culation();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, position + 1);
fragment.setArguments(args);
}
if(position==2){
fragment = new GraphDisplay();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, position + 1);
fragment.setArguments(args);
}
return fragment;
}
@Override
public int getCount() {
return 3;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0 :
return "Select item";
case 1:
return "Calculation";
case 2:
return "Graph";
}
return null;
}
}
它不是working.while改變進度頁面獲取刷卡 –
檢查我的編輯ANS –
,我應該寫this.i沒有延伸viewpager.if我把這個在我所提到的上述我得到錯誤onInterceptTouchEvent –