本文整理汇总了Java中android.support.v4.view.ViewPager.getLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPager.getLayoutParams方法的具体用法?Java ViewPager.getLayoutParams怎么用?Java ViewPager.getLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewPager
的用法示例。
在下文中一共展示了ViewPager.getLayoutParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initUI
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initUI(){
previewOperationBar = (LinearLayout) findViewById(R.id.picker_image_preview_operator_bar);
originalImage = (ImageButton) findViewById(R.id.picker_image_preview_orignal_image);
originalImage.setOnClickListener(this);
originalImageSizeTip = (TextView) findViewById(R.id.picker_image_preview_orignal_image_tip);
if(!isSupportOriginal){
originalImage.setVisibility(View.INVISIBLE);
originalImageSizeTip.setVisibility(View.INVISIBLE);
}
previewSendBtn = (TextView) findViewById(R.id.picker_image_preview_send);
previewSendBtn.setOnClickListener(this);
updateSelectBtnStatus();
updateOriImageSizeTip(isSendOriginalImage);
imageViewPager = (ViewPager) findViewById(R.id.picker_image_preview_viewpager);
imageViewPager.setOnPageChangeListener(this);
imageViewPager.setOffscreenPageLimit(2);
imageViewPagerAdapter = new PickerPreviewPagerAdapter(this, photoLists, getLayoutInflater(),
imageViewPager.getLayoutParams().width, imageViewPager.getLayoutParams().height, this);
imageViewPager.setAdapter(imageViewPagerAdapter);
setTitleIndex(firstDisplayImageIndex);
updateTitleSelect(firstDisplayImageIndex);
imageViewPager.setCurrentItem(firstDisplayImageIndex);
}
示例2: setupViewPager
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public static void setupViewPager(final ViewPager viewPager) {
ViewGroup.LayoutParams layoutParams = viewPager.getLayoutParams();
layoutParams.width = ((Activity) viewPager.getContext()).getWindowManager().getDefaultDisplay().getWidth() / 7 * 5;
layoutParams.height = (int) ((layoutParams.width / 0.75));
viewPager.setOffscreenPageLimit(2);
if (viewPager.getParent() instanceof ViewGroup) {
ViewGroup viewParent = ((ViewGroup) viewPager.getParent());
viewParent.setClipChildren(false);
viewPager.setClipChildren(false);
}
viewPager.setPageTransformer(true, new ExpandingViewPagerTransformer());
// viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
// @Override
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// ExpandingFragment expandingFragment = getCurrentFragment(viewPager);
// if(expandingFragment != null && expandingFragment.isOpenend()){
// expandingFragment.close();
// }
// }
//
// @Override
// public void onPageSelected(int position) {
//
// }
//
// @Override
// public void onPageScrollStateChanged(int state) {
//
// }
// });
}
示例3: onCreateView
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d("onCreateView " + this);
View rod = inflater.inflate(R.layout.drama_og_bog_frag, container, false);
karruselAdapter = new KarruselAdapter(getChildFragmentManager());
viewPager = (ViewPager) rod.findViewById(R.id.pager);
viewPager.setAdapter(karruselAdapter);
viewPager.getLayoutParams().height = billedeHø; // Viewpageren skal fylde præcist ét billede i højden
karruselIndikator = (CirclePageIndicator)rod.findViewById(R.id.indicator);
karruselIndikator.setViewPager(viewPager);
final float density = getResources().getDisplayMetrics().density;
karruselIndikator.setRadius(5 * density);
karruselIndikator.setPageColor(Color.BLACK);
karruselIndikator.setFillColor(App.color.blå);
karruselIndikator.setStrokeColor(0);
karruselIndikator.setStrokeWidth(0);
App.data.dramaOgBog.observatører.add(this);
run();
viewPager.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction()==MotionEvent.ACTION_DOWN || event.getAction()==MotionEvent.ACTION_UP) {
App.forgrundstråd.removeCallbacks(skiftTilNæsteIKarrusellen);
App.forgrundstråd.postDelayed(skiftTilNæsteIKarrusellen, 10000);
}
return false;
}
});
App.forgrundstråd.postDelayed(skiftTilNæsteIKarrusellen, 10000);
AQuery aq = new AQuery(rod);
listView = (PinnedSectionListView) aq.id(R.id.listView).adapter(listeAdapter).getListView();
listView.setEmptyView(aq.id(R.id.tom).typeface(App.skrift_gibson).getView());
listView.setOnItemClickListener(this);
return rod;
}
示例4: setPagerProperties
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void setPagerProperties(final ViewPager vp) {
final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) vp.getLayoutParams();
lp.height = mEmojiKeyboardHeight;
lp.bottomMargin = mEmojiPagerBottomMargin;
vp.setLayoutParams(lp);
}