本文整理汇总了Java中android.support.v4.view.ViewPager.LayoutParams.WRAP_CONTENT属性的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.WRAP_CONTENT属性的具体用法?Java LayoutParams.WRAP_CONTENT怎么用?Java LayoutParams.WRAP_CONTENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.view.ViewPager.LayoutParams
的用法示例。
在下文中一共展示了LayoutParams.WRAP_CONTENT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
@Override public @Nullable View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ViewPager view = new ViewPager(getActivity()); // container.getContext() results in white on white text
view.setId(android.R.id.list);
view.setLayoutParams(new MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
PagerTitleStrip title = new PagerTabStrip(view.getContext());
ViewPager.LayoutParams params = new ViewPager.LayoutParams();
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.TOP;
title.setLayoutParams(params);
view.addView(title);
return view;
}
示例2: expand
public static void expand(final View v) {
v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
final int targtetHeight = v.getMeasuredHeight();
v.getLayoutParams().height = 0;
v.setVisibility(View.VISIBLE);
Animation a = new Animation()
{
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
v.getLayoutParams().height = interpolatedTime == 1
? LayoutParams.WRAP_CONTENT
: (int)(targtetHeight * interpolatedTime);
v.requestLayout();
}
@Override
public boolean willChangeBounds() {
return true;
}
};
// 1dp/ms
a.setDuration(((int) (targtetHeight / v.getContext().getResources().getDisplayMetrics().density))*2);
v.startAnimation(a);
}
示例3: onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
//Create the AdView fragment container layout
View v = inflater.inflate(R.layout.fragment_ad, container, false);
//Generate the AdView and configure it
mAdView = new AdView(v.getContext());
mAdView.setVisibility(View.GONE);
RelativeLayout.LayoutParams mAdViewLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
mAdView.setLayoutParams(mAdViewLayout);
//...set the Ads info
mAdView.setAdSize(adSize);
mAdView.setAdUnitId(adUnitId);
//Add the AdView to the fragment container layout :)
((RelativeLayout)v).addView(mAdView);
return v;
}
示例4: init
private void init() {
LinearLayout view = new LinearLayout(context);
view.setOrientation(LinearLayout.VERTICAL);
view.setGravity(Gravity.CENTER_HORIZONTAL);
view.setBackgroundColor(Color.rgb(224, 224, 224));
view.setPadding(1, 1, 1, 1);
listView = new ListView(context);
adapter = new PopAdapter();
listView.setAdapter(adapter);
listView.setCacheColorHint(0x00000000);
listView.setDivider(new ColorDrawable(0xe0e0e0));
listView.setDividerHeight(1);
if (this.config != null && this.config.getBackground_resId() != 0) {
listView.setBackgroundResource(this.config.getBackground_resId());
} else {
listView.setBackgroundColor(Color.rgb(224, 224, 224));
}
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
view.addView(listView, layoutParams);
if (this.config != null && this.config.getWidth() > 0) {
popupWindow = new PopupWindow(view, this.config.getWidth(),
LayoutParams.WRAP_CONTENT);
} else {
// 为了自适应长度添加
TextView text = new TextView(context);
text.setHeight(0);
text.setText("图片的空" + getMostItemText());
text.setTextSize(16);
text.setPadding(5, 5, 5, 5);
view.addView(text, layoutParams1);
popupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
}
if (dismissListener != null) {
popupWindow.setOnDismissListener(dismissListener);
}
// 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景(很神奇的)
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// 使其聚集
popupWindow.setFocusable(true);
// 设置允许在外点击消失
popupWindow.setOutsideTouchable(true);
// 刷新状态
popupWindow.update();
popupWindow.setTouchInterceptor(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
popupWindow.dismiss();
return true;
}
return false;
}
});
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// 获取该行的数据
PopMenuItem popMenuItem = (PopMenuItem) listView.getAdapter()
.getItem(arg2);
if (popMenuItem.listener != null) {
popMenuItem.listener.onItemClick();
dismiss();
}
}
});
}
示例5: createButtonLayoutParams
public LinearLayout.LayoutParams createButtonLayoutParams() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
return params;
}
示例6: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.imgView = (ImageView) findViewById(R.id.imageView1);
containerLayoutFrame = (LinearLayout) findViewById(R.id.layout);
filtersInt = new int[NUMBERS_OF_FILTERS];
imgFilters = new ImageView[filtersInt.length];
lyparams.height = LayoutParams.MATCH_PARENT;
lyparams.width = LayoutParams.WRAP_CONTENT;
onClickListenerImagesFilter=new OnClicListenerImagesFilter();
filtersInt[0]=BitmapFilter.GRAY_STYLE;
filtersInt[1]=BitmapFilter.BLOCK_STYLE;
filtersInt[2]=BitmapFilter.BLUR_STYLE;
filtersInt[3]=BitmapFilter.GAUSSIAN_BLUR_STYLE;
filtersInt[4]=BitmapFilter.HDR_STYLE;
filtersInt[5]=BitmapFilter.INVERT_STYLE;
filtersInt[6]=BitmapFilter.LIGHT_STYLE;
filtersInt[7]=BitmapFilter.LOMO_STYLE;
filtersInt[8]=BitmapFilter.NEON_STYLE;
filtersInt[9]=BitmapFilter.OIL_STYLE;
filtersInt[10]=BitmapFilter.OLD_STYLE;
filtersInt[11]=BitmapFilter.PIXELATE_STYLE;
filtersInt[12]=BitmapFilter.RELIEF_STYLE;
filtersInt[13]=BitmapFilter.SHARPEN_STYLE;
filtersInt[14]=BitmapFilter.SKETCH_STYLE;
filtersInt[15]=BitmapFilter.SOFT_GLOW_STYLE;
filtersInt[16]=BitmapFilter.TOTAL_FILTER_NUM;
filtersInt[17]=BitmapFilter.TV_STYLE;
// we convert the image on imgView to a bitmap
abmp = (BitmapDrawable) imgView.getDrawable();
bmp = abmp.getBitmap();
originalImageSacled=bmp;
myBitmap=bmp;
sacleMainImage();
loadFilters();
}