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


Java LayoutParams类代码示例

本文整理汇总了Java中android.support.v4.view.ViewPager.LayoutParams的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams类的具体用法?Java LayoutParams怎么用?Java LayoutParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LayoutParams类属于android.support.v4.view.ViewPager包,在下文中一共展示了LayoutParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@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;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:17,代码来源:GlidePagerFragment.java

示例2: showShareByWeixin

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
/**
 * popwd显示 分享

 */
public static PopupWindow showShareByWeixin(final Context ctx, View parent, OnClickListener l) {
	LayoutInflater inflater = LayoutInflater.from(ctx);
	View view = inflater.inflate(R.layout.share_popwed_show, null);
	final PopupWindow sharePopwd = new PopupWindow(view, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	view.findViewById(R.id.sendfrient).setOnClickListener(l);
	view.findViewById(R.id.sharefriend).setOnClickListener(l);
	view.findViewById(R.id.share_popwd).setOnClickListener(new OnClickListener() {
		@Override
		public void onClick(View v) {
			sharePopwd.dismiss();
		}
	});
	sharePopwd.setFocusable(true);
	sharePopwd.setOutsideTouchable(true);
	sharePopwd.setBackgroundDrawable(new BitmapDrawable()); //
	sharePopwd.showAtLocation(parent, Gravity.CENTER, 0, 0);

	return sharePopwd;
}
 
开发者ID:tincent,项目名称:libtincent,代码行数:24,代码来源:PopwdUtil.java

示例3: instantiateItem

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@Override
public Object instantiateItem(final ViewGroup container,final int position)
  {
  TextView textView=new TextView(MainActivity.this);
  textView.setText("item"+position);
  textView.setBackgroundColor(colors[position]);
  textView.setGravity(Gravity.CENTER);
  final LayoutParams params=new LayoutParams();
  params.height=LayoutParams.MATCH_PARENT;
  params.width=LayoutParams.MATCH_PARENT;
  params.gravity=Gravity.CENTER;
  textView.setLayoutParams(params);
  textView.setTextColor(0xff000000);
  container.addView(textView);
  return textView;
  }
 
开发者ID:AndroidDeveloperLB,项目名称:ParallaxViewPagers,代码行数:17,代码来源:MainActivity.java

示例4: instantiateItem

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
	ImageView iamgeView = new ImageView(activity);
	iamgeView.setPadding(Util.dip2px(10, activity),
			Util.dip2px(10, activity), Util.dip2px(10, activity),
			Util.dip2px(10, activity));
	int bg = Color.rgb((int) Math.floor(Math.random() * 128) + 64,
			(int) Math.floor(Math.random() * 128) + 64,
			(int) Math.floor(Math.random() * 128) + 64);
	iamgeView.setBackgroundColor(bg);
	iamgeView.setImageResource(Constant.nature_images[position]);
	container.addView(iamgeView, LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT);
	jazzPager.setObjectForPosition(iamgeView, position);
	return iamgeView;
}
 
开发者ID:qndroid,项目名称:AndroidOpenSource,代码行数:17,代码来源:JazzPagerAdapter.java

示例5: expand

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
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);
}
 
开发者ID:mauriciogior,项目名称:commit-android,代码行数:27,代码来源:CommitmentsFragment.java

示例6: instantiateItem

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
public Object instantiateItem(ViewGroup container, int position)
{
	PhotoView photoView = new PhotoView(baseActivity);
	container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	String mImagePath = mImageUrls.get(position);
	if (isNetworkImg(mImagePath))
	{
		DisplayImageOptions options = new DisplayImageOptions.Builder().imageScaleType(ImageScaleType.EXACTLY_STRETCHED).showStubImage(R.drawable.ic_default_image).showImageForEmptyUri(R.drawable.ic_default_image).bitmapConfig(Config.RGB_565).build();
		mImageLoader.displayImage(mImagePath, photoView, options);
	}
	else
	{
		photoView.setImageBitmap(BitmapUtils.getBitmap(mImagePath, baseActivity.getResources().getDisplayMetrics().widthPixels, baseActivity.getResources().getDisplayMetrics().heightPixels));
	}
	return photoView;
}
 
开发者ID:haikuowuya,项目名称:like_googleplus_layout,代码行数:17,代码来源:ImagePagerAdapter.java

示例7: onCreate

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@Override
public void onCreate(final Bundle saved)
{
  super.onCreate(saved);
  
  map_ = new CycleMapView(this, this.getClass().getName());
  map_.overlayPushBottom(new RouteOverlay(this));
  map_.overlayPushTop(new LockScreenOnOverlay(this, map_));
  map_.overlayPushTop(new LiveRideOverlay(this, map_));
  map_.lockOnLocation();
  map_.hideLocationButton();
  
  final RelativeLayout rl = new RelativeLayout(this);
  rl.addView(map_, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
  setContentView(rl);
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:17,代码来源:LiveRideActivity.java

示例8: onCreateView

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@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;
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:22,代码来源:AdFragment.java

示例9: addResultListItem

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
public void addResultListItem(String title, String value, LinearLayout  netLayout) {
	final float scale = activity.getResources().getDisplayMetrics().density;
    final int leftRightItem = Helperfunctions.dpToPx(5, scale);
    final int topBottomItem = Helperfunctions.dpToPx(5, scale);
    final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
    final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
    final int heightDiv = Helperfunctions.dpToPx(1, scale);        
    final int topBottomImg = Helperfunctions.dpToPx(1, scale);
    
    final LinearLayout netItemLayout = new LinearLayout(activity); 
    
    netItemLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem);
    
    netItemLayout.setGravity(Gravity.CENTER_VERTICAL);
    
    final TextView itemTitle = new TextView(activity, null, R.style.listResultItemTitle);
    itemTitle.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT, 0.4f));
    itemTitle.setWidth(0);
    itemTitle.setGravity(Gravity.LEFT);
    itemTitle.setText(title);
    
    netItemLayout.addView(itemTitle);
    
    final ImageView itemClassification = new ImageView(activity);
    itemClassification.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT, 0.1f));
    itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);
    
    itemClassification.setImageDrawable(activity.getResources().getDrawable(
            R.drawable.traffic_lights_none));
    netItemLayout.addView(itemClassification);
    
    final TextView itemValue = new TextView(activity, null, R.style.listResultItemValue);
    itemValue.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT, 0.5f));
    itemValue.setWidth(0);
    itemValue.setGravity(Gravity.LEFT);
    itemValue.setText(value);
    
    netItemLayout.addView(itemValue);
    
    netLayout.addView(netItemLayout);
    
    final View divider = new View(activity);
    divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv,
            1));
    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);
    
    divider.setBackgroundResource(R.drawable.bg_trans_light_10);
    
    netLayout.addView(divider);
    
    netLayout.invalidate();
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:58,代码来源:RMBTResultPagerAdapter.java

示例10: getView

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	// if (false) {
	// if (this.accFileCallback == null) {
	// return null;
	// }
	ACCFile accFile = this.imageData.getAccFiles().get(position);
	ImageView imageView = !this.isBig ? new ImageView(this.context)
			: new AutoImageView(this.context, position == 0,
					position == this.getCount() - 1,
					this.onSingleTapListener);
	Bitmap bitmap = this.bitmapProviderManager.getBitmap(accFile);
	// if (bitmap == null || bitmap.isRecycled()) {
	// bitmap = BitmapManager.getInstance(context).getBlankBitmap();
	// }
	// LogUtil.systemOut("bitmap == null:");
	// LogUtil.systemOut(bitmap == null);
	// if (true) {
	if (this.isBig) {
		imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
	}
	// this.isBig ?
	// :autoImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
	imageView.setLayoutParams(new Gallery.LayoutParams(
			LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
	// imageView.setBackgroundResource(R.drawable.login_input);
	// }
	// System.out.println(position);
	imageView.setImageBitmap(bitmap);
	if (this.isBig && accFile.getProgress() != null) {
		((AutoImageView) imageView).setProgress(accFile.getProgress());
	}
	// }
	return imageView;
}
 
开发者ID:AfirSraftGarrier,项目名称:ACCAndroid,代码行数:36,代码来源:ImageAdapter.java

示例11: instantiateItem

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
	PhotoView photoView = new PhotoView(container.getContext());

	WeboApplication.getImageLoader().displayImage(
			Utils.getMiddlePicURL(mImgesURLList.get(position)),
			photoView,
			Configure.getFullScreenImageDisplayImageOptions());

	// Now just add PhotoView to ViewPager and return it
	container.addView(photoView, LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT);

	return photoView;
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:16,代码来源:ShowImagesViewPagerActivity.java

示例12: onCreate

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
@Override
/**
 * Gets called on start of app. Checks availability of SD card and initiates GUI objects. 
 */
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	//shows the app, even if screen lock is active
	this.getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);		

	// check for sd card
	if (!SDCardHandler.isMounted()) {
		if (SDCardHandler.isRemoved()) {
			exit("Please insert a SD card");
		} else if (SDCardHandler.isShared()) {
			exit("Please stop USB mass storage mode");
		} else {
			exit("SD card error!");
		}
	} else {
		try {
			SDCardHandler.mkDir(DIRECTORY);
		} catch (IOException e) {
			exit("No write access to SD card");
		}

		setContentView(R.layout.activity_artifact_extract);
		browserHCheck = (CheckBox) findViewById(R.id.browserHCheck);
		browserSCheck = (CheckBox) findViewById(R.id.browserSCheck);
		calendarCheck = (CheckBox) findViewById(R.id.calendarCheck);
		callCheck = (CheckBox) findViewById(R.id.callCheck);
		contactCheck = (CheckBox) findViewById(R.id.contactCheck);
		mmsCheck = (CheckBox) findViewById(R.id.mmsCheck);
		smsCheck = (CheckBox) findViewById(R.id.smsCheck);
		selectAll(null);
	}
}
 
开发者ID:j-koenig,项目名称:osaft,代码行数:38,代码来源:ArtifactExtract.java

示例13: createView

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
protected static ImageView createView(ViewGroup parent) {
	ImageView view = new ImageView(parent.getContext());
	view.setId(R.id.image);
	view.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	return view;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:7,代码来源:GlidePagerFragment.java

示例14: init

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
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();
			}
		}

	});
}
 
开发者ID:entboost,项目名称:EntboostIM,代码行数:77,代码来源:PopMenu.java

示例15: createButtonLayoutParams

import android.support.v4.view.ViewPager.LayoutParams; //导入依赖的package包/类
public LinearLayout.LayoutParams createButtonLayoutParams() {
	LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	return params;
}
 
开发者ID:cdkd321,项目名称:pure,代码行数:6,代码来源:ActionSheet.java


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