本文整理汇总了Java中android.support.v4.view.ViewPager.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPager.LayoutParams方法的具体用法?Java ViewPager.LayoutParams怎么用?Java ViewPager.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewPager
的用法示例。
在下文中一共展示了ViewPager.LayoutParams方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initImages
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initImages() {
mImageViews = new ArrayList<>();
ViewPager.LayoutParams lp=new ViewPager.LayoutParams();
lp.gravity= Gravity.LEFT;
ImageView imageView1 = new ImageView(this);
imageView1.setImageResource(R.drawable.jay_fantexi);
imageView1.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView2 = new ImageView(this);
imageView2.setImageResource(R.drawable.jay_jay);
imageView2.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView3 = new ImageView(this);
imageView3.setImageResource(R.drawable.image2);
imageView3.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView4 = new ImageView(this);
imageView4.setImageResource(R.drawable.jay_jay);
imageView4.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView5 = new ImageView(this);
imageView5.setImageResource(R.drawable.logo);
imageView5.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView1.setLayoutParams(lp);
imageView2.setLayoutParams(lp);
imageView3.setLayoutParams(lp);
imageView4.setLayoutParams(lp);
imageView5.setLayoutParams(lp);
mImageViews.add(imageView1);
mImageViews.add(imageView2);
mImageViews.add(imageView3);
mImageViews.add(imageView4);
mImageViews.add(imageView5);
}
示例2: HTViewPagerWithIndicator
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public HTViewPagerWithIndicator(Context context, AttributeSet attrs) {
super(context, attrs);
// 添加SlidingTabLayout
readStyleParameters(attrs);
ViewPager.LayoutParams lp = new ViewPager.LayoutParams();
lp.height = ViewPager.LayoutParams.WRAP_CONTENT;
lp.width = ViewPager.LayoutParams.MATCH_PARENT;
lp.gravity = mSlidingTabLayoutGravity == 0 ? Gravity.TOP : Gravity.BOTTOM;
mSlidingTabLayout = new SlidingTabLayout(getContext(), attrs);
mDataSetObserver = new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
mSlidingTabLayout.notifyDataSetChanged();
}
@Override
public void onInvalidated() {
super.onInvalidated();
}
};
addView(mSlidingTabLayout, -1, lp);
}
示例3: initViews
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initViews() {
//initialize the viewpager
mViewPager = new ViewPager(mContext);
ViewPager.LayoutParams lp = new ViewPager.LayoutParams();
lp.width = ViewPager.LayoutParams.MATCH_PARENT;
lp.height = ViewPager.LayoutParams.MATCH_PARENT;
mViewPager.setLayoutParams(lp);
//initialize the indicator
mIndicator = new ViewPagerIndicator(mContext);
LayoutParams indicatorlp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
indicatorlp.gravity = Gravity.BOTTOM | Gravity.CENTER;
indicatorlp.bottomMargin = 20;
mIndicator.setLayoutParams(indicatorlp);
}
示例4: initImgs
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initImgs() {
mImageViews = new ArrayList<>();
mStringList=new ArrayList<>();
ViewPager.LayoutParams lp = new ViewPager.LayoutParams();
lp.gravity = Gravity.LEFT;
ImageView imageView1 = new ImageView(this);
imageView1.setImageResource(R.drawable.jay_fantexi);
imageView1.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView2 = new ImageView(this);
imageView2.setImageResource(R.drawable.jay_jay);
imageView2.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView3 = new ImageView(this);
imageView3.setImageResource(R.drawable.logo);
imageView3.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView4 = new ImageView(this);
imageView4.setImageResource(R.drawable.image2);
imageView4.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView5 = new ImageView(this);
imageView5.setImageResource(R.drawable.jay_jay);
imageView5.setScaleType(ImageView.ScaleType.CENTER_CROP);
ImageView imageView6 = new ImageView(this);
imageView6.setImageResource(R.drawable.logo);
imageView6.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView1.setLayoutParams(lp);
imageView2.setLayoutParams(lp);
imageView3.setLayoutParams(lp);
imageView4.setLayoutParams(lp);
imageView5.setLayoutParams(lp);
imageView6.setLayoutParams(lp);
mImageViews.add(imageView1);
mImageViews.add(imageView2);
mImageViews.add(imageView3);
mImageViews.add(imageView4);
mImageViews.add(imageView5);
mImageViews.add(imageView6);
mStringList.add("youngkaaa test 1");
mStringList.add("hahahahha");
mStringList.add("yyyyyyyyyyyyyyy");
mStringList.add("aaaaaaaaaaaaaa");
mStringList.add("pipipipipipipipipi");
mStringList.add("kkkkkkkkkkkkkkkkk");
}
示例5: onAttachedToWindow
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
final ViewParent parent = getParent();
if (!(parent instanceof ViewPager)) {
throw new IllegalStateException("PagerIndicator must be a direct child of a ViewPager.");
}
((ViewPager.LayoutParams) getLayoutParams()).isDecor = true;
mParentPager = (ViewPager) parent;
mParentPager.addOnPageChangeListener(this);
}
示例6: initViews
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initViews() {
//initialize the viewpager
mViewPager = new ViewPager(mContext);
ViewPager.LayoutParams lp = new ViewPager.LayoutParams();
lp.width = ViewPager.LayoutParams.MATCH_PARENT;
lp.height = ViewPager.LayoutParams.MATCH_PARENT;
mViewPager.setLayoutParams(lp);
//initialize the indicator
mIndicator = new ViewPagerIndicator(mContext);
FrameLayout.LayoutParams indicatorlp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
indicatorlp.gravity = Gravity.BOTTOM | Gravity.CENTER;
indicatorlp.bottomMargin = 20;
mIndicator.setLayoutParams(indicatorlp);
}
示例7: addScrollerPager
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
/**
* 装载ScrollerPager
*/
private void addScrollerPager() {
ViewPager.LayoutParams layoutParams = new ViewPager.LayoutParams();
layoutParams.width = ViewPager.LayoutParams.MATCH_PARENT;
layoutParams.height = ViewPager.LayoutParams.MATCH_PARENT;
mContainer.addView(this, layoutParams);
}
示例8: generateDefaultLayoutParams
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
return new ViewPager.LayoutParams();
}
示例9: addView
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void addView(View child, ViewPager.LayoutParams params) {
super.addView(wrapChild(child), params);
}