本文整理汇总了Java中android.support.v4.view.ViewPager.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPager.setLayoutParams方法的具体用法?Java ViewPager.setLayoutParams怎么用?Java ViewPager.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewPager
的用法示例。
在下文中一共展示了ViewPager.setLayoutParams方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViewPage
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initViewPage() {
setOrientation(VERTICAL);
_viewPager = new ViewPager(_context);
_llDot = new LinearLayout(_context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
CommonUtil.getDefaultPannelHeight(_context));
params.gravity=Gravity.BOTTOM;
_viewPager.setLayoutParams(params);
_llDot.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
_llDot.setGravity(Gravity.CENTER);
_llDot.setOrientation(HORIZONTAL);
addView(_viewPager);
addView(_llDot);
}
示例2: 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);
}
示例3: initControl
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initControl(){
/*set it to be no title*/
requestWindowFeature(Window.FEATURE_NO_TITLE);
/*set it to be full screen*/
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_image_show);
iamgeViewPager = (ViewPager) findViewById(R.id.image_pager);
LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
iamgeViewPager.setLayoutParams(params);
iamgeViewPager.setOnPageChangeListener(pageChangeListener);
guidPview = (ViewGroup) findViewById(R.id.guid_point);
setImageViewPager(false);
delButton = (Button) findViewById(R.id.b_right_id);
if (getIntent().getStringExtra("delete").equals("delete")) {
delButton.setVisibility(View.GONE);
}
delButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mImages.size() > 1) {
mImages.remove(cus);
GlobalData.setImagesList(mImages);
setImageViewPager(false);
} else {
mImages.remove(0);
GlobalData.setImagesList(mImages);
Intent intent = new Intent();
setResult(CodeDefine.IMAGE_SHOW_RESULT, intent);
finish();
}
}
});
}
示例4: 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);
}
示例5: initViewPage
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initViewPage() {
setOrientation(VERTICAL);
_viewPager = new ViewPager(_context);
_llDot = new LinearLayout(_context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
CommonUtil.getDefaultPannelHeight(_context));
params.gravity=Gravity.BOTTOM;
_viewPager.setLayoutParams(params);
_llDot.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
_llDot.setGravity(Gravity.CENTER);
_llDot.setOrientation(HORIZONTAL);
addView(_viewPager);
addView(_llDot);
}
示例6: initChild
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initChild() {
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
viewPager = new ViewPager(context);
viewPager.setLayoutParams(params);
//viewpager初始化
setScrollTime(Default_scrollTime);
//触摸时停止轮播
viewPager.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
stopAutoPlay();
break;
case MotionEvent.ACTION_UP:
startAutoPlay();
break;
}
return false;
}
});
//指示器初始化
llIndicators = new LinearLayout(context);
LayoutParams layoutParams1 = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
layoutParams1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
switch (indicator_gravity) {
case 1:
layoutParams1.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
break;
case 2:
layoutParams1.addRule(RelativeLayout.CENTER_HORIZONTAL);
break;
case 3:
layoutParams1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
break;
}
llIndicators.setLayoutParams(layoutParams1);
this.addView(viewPager);
this.addView(llIndicators);
}
示例7: initChild
import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void initChild() {
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
viewPager = new ViewPager(context);
viewPager.setLayoutParams(params);
//viewpager初始化
setScrollTime(Default_scrollTime);
//触摸时停止轮播
viewPager.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
handler.removeMessages(0);
break;
case MotionEvent.ACTION_MOVE:
handler.removeMessages(0);
break;
case MotionEvent.ACTION_UP:
handler.sendEmptyMessageDelayed(0, 3000);
break;
}
return false;
}
});
//指示器初始化
llIndicators = new LinearLayout(context);
LayoutParams layoutParams1 = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
layoutParams1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
switch (indicator_gravity) {
case 1:
layoutParams1.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
break;
case 2:
layoutParams1.addRule(RelativeLayout.CENTER_HORIZONTAL);
break;
case 3:
layoutParams1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
break;
}
llIndicators.setLayoutParams(layoutParams1);
this.addView(viewPager);
this.addView(llIndicators);
}
示例8: 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);
}