I am creating an Android application with a target value of 2.2. I still want to use the ViewPager provided in android.support-v4.jar.i, I need to disable the Viewpager view on the click.i button, use the following code to disable it. but its not working.
public class ServiesDeail extends FragmentActivity{ ServiesTitleFragmentAdapter mAdapter; ViewPager mPager; int position = 0 ; @SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mastermenu); LinearLayout lnrparent = (LinearLayout) findViewById(R.id.LL_001); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.menu_deatil, null); lnrparent.addView(view); mAdapter = new ServiesTitleFragmentAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pagerone); mPager.setAdapter(mAdapter); TitlePageIndicator indicator = (TitlePageIndicator) findViewById(R.id.indicatorone); indicator.setViewPager(mPager,position); Menu_Button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mPager.setClickable(false); } }); } }
If you have any ideas, anyone .. please give me an answer .. I'm waiting for your answer
source share