本文整理匯總了Java中android.support.v4.view.ViewPager.post方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewPager.post方法的具體用法?Java ViewPager.post怎麽用?Java ViewPager.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.view.ViewPager
的用法示例。
在下文中一共展示了ViewPager.post方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: wrapperViewPager
import android.support.v4.view.ViewPager; //導入方法依賴的package包/類
protected void wrapperViewPager(final ViewPager viewPager, final PagerPrimaryAdapter primaryAdapter) {
viewPager.post(new Runnable() {
int count = 0;
PagerPrimaryAdapter mAdapter = primaryAdapter;
@Override
public void run() {
count++;
PagerAdapter adapter = viewPager.getAdapter();
if (adapter != null) {
if (adapter instanceof PagerPrimaryAdapter) {
if (adapter == primaryAdapter && count < 10) {
viewPager.postDelayed(this, 500);
}
} else {
if (mAdapter == null) {
mAdapter = new PagerPrimaryAdapter(adapter);
} else {
mAdapter.wrapper(adapter);
}
mAdapter.attachViewPager(viewPager);
}
} else if (count < 10) {
viewPager.postDelayed(this, 500);
}
}
});
}
示例2: wrapperViewPager
import android.support.v4.view.ViewPager; //導入方法依賴的package包/類
private void wrapperViewPager(final ViewPager viewPager, PagerPrimaryAdapter primaryAdapter) {
viewPager.post(new Runnable() {
int count = 0;
PagerPrimaryAdapter mAdapter = primaryAdapter;
@Override
public void run() {
count++;
PagerAdapter adapter = viewPager.getAdapter();
if (adapter != null) {
if (adapter instanceof PagerPrimaryAdapter) {
if (adapter == primaryAdapter) {
viewPager.postDelayed(this, 500);
}
} else {
if (mAdapter == null) {
mAdapter = new PagerPrimaryAdapter(adapter);
} else {
mAdapter.wrapper(adapter);
}
mAdapter.attachViewPager(viewPager);
}
} else if (count < 10) {
viewPager.postDelayed(this, 500);
}
}
});
}