当前位置: 首页>>代码示例>>Java>>正文


Java ViewPager.LayoutParams方法代码示例

本文整理汇总了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);
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:39,代码来源:MainActivity.java

示例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);
}
 
开发者ID:NEYouFan,项目名称:ht-viewpagerwithindicator,代码行数:24,代码来源:HTViewPagerWithIndicator.java

示例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);
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:16,代码来源:BannerViewPager.java

示例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");

}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:53,代码来源:BannerActivity.java

示例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);
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:12,代码来源:PagerIndicator.java

示例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);
}
 
开发者ID:yuhodev,项目名称:login,代码行数:16,代码来源:BannerViewPager.java

示例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);
}
 
开发者ID:ryanlijianchang,项目名称:AdPlayBanner,代码行数:10,代码来源:ScrollerPager.java

示例8: generateDefaultLayoutParams

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
    return new ViewPager.LayoutParams();
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:5,代码来源:YViewPagerNew.java

示例9: addView

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
public void addView(View child, ViewPager.LayoutParams params) {
    super.addView(wrapChild(child), params);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:JazzyViewPager.java


注:本文中的android.support.v4.view.ViewPager.LayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。