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


Java LayoutParams类代码示例

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


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

示例1: CSGalleryAdapter

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public CSGalleryAdapter(Context context) {
	mContext         = context;
	mDimension       = false;
	mViewList        = new ArrayList<View>();
	mOrgViewSizeList = new HashMap<Integer,Size>();
	
	//预设控件自适应所使用的显示参数
	initDisplay();
	
	//初始化一个默认元素
	TextView nonItem = new TextView(mContext);
	nonItem.setText("还没有添加元素...");
	nonItem.setTextSize(22);
	nonItem.setGravity(Gravity.CENTER);
	nonItem.setTextColor(Color.parseColor("#ff0000"));
	nonItem.setBackgroundResource(android.R.drawable.toast_frame);
	nonItem.setLayoutParams(new Gallery.LayoutParams(200, 200));
	mNonItem = nonItem;
}
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:20,代码来源:CSGalleryAdapter.java

示例2: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	ImageView iv = null;
	if (convertView == null) {
		iv = new ImageView(context);
	} else {
		iv = (ImageView) convertView;
	}

	Bitmap bitmap = ImageUtils.getBitmap(context, imageResIDs[position],
			position);
	BitmapDrawable bd = new BitmapDrawable(context.getResources(), bitmap);
	bd.setAntiAlias(true);
	iv.setImageDrawable(bd);
	iv.setLayoutParams(new LayoutParams(Util.dip2px(160, context), (Util
			.dip2px(240, context))));
	return iv;
}
 
开发者ID:qndroid,项目名称:AndroidOpenSource,代码行数:20,代码来源:GalleryAdapter.java

示例3: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
  a locala;
  if (paramView == null)
  {
    paramView = LayoutInflater.from(this.b).inflate(e.a(this.b, "l_details_gallery"), null);
    paramView.setLayoutParams(new Gallery.LayoutParams(-2, -2));
    locala = new a(null);
    locala.a = ((ImageView)paramView.findViewById(d.a(this.b, "gallery_image")));
    paramView.setTag(locala);
  }
  while (true)
  {
    d.b("图片url:" + (String)this.a.get(paramInt % this.a.size()));
    this.c.requestImageAsyn(this.b, (String)this.a.get(paramInt % this.a.size()), locala.a);
    locala.a.setScaleType(ImageView.ScaleType.FIT_XY);
    return paramView;
    locala = (a)paramView.getTag();
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:21,代码来源:i.java

示例4: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
  a locala;
  if (paramView == null)
  {
    paramView = LayoutInflater.from(this.b).inflate(e.a(this.b, "l_home_gallery"), null);
    paramView.setLayoutParams(new Gallery.LayoutParams(-1, -2));
    locala = new a();
    locala.a = ((ImageView)paramView.findViewById(d.a(this.b, "gallery_image")));
    paramView.setTag(locala);
  }
  while (true)
  {
    e.b("图片下载地址:" + (String)this.a.get(paramInt % this.a.size()));
    this.c.requestImageAsyn(this.b, (String)this.a.get(paramInt % this.a.size()), locala.a);
    locala.a.setScaleType(ImageView.ScaleType.FIT_XY);
    return paramView;
    locala = (a)paramView.getTag();
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:21,代码来源:m.java

示例5: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public View getView(final int position, View convertView, ViewGroup parent) {
    ImageView i = new ImageView(mContext);

    i.setImageResource(THUMB_IDS[position]);
    i.setAdjustViewBounds(true);
    i.setLayoutParams(new Gallery.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    i.setBackgroundResource(android.R.drawable.picture_frame);
    return i;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:11,代码来源:Wallpaper.java

示例6: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent)
{
	ImageView imageview = mViewMap.get(position % mCount);
	if (imageview == null)
	{
		imageview = new ImageView(mContext);
		imageview.setImageBitmap(bitmap.get(position % bitmap.size()));
		imageview.setScaleType(ImageView.ScaleType.FIT_XY);
		imageview.setLayoutParams(new Gallery.LayoutParams(300,200));
		//imageview.setBackgroundResource(mGalleryItemBackground);
		mViewMap.put((position % mCount), imageview);
	}
	return imageview;
}
 
开发者ID:liningwang,项目名称:camera,代码行数:15,代码来源:PictrueView.java

示例7: makeView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
@Override
public View makeView()
{
	ImageView imageView = new ImageView(this);
	imageView.setBackgroundColor(0xFF000000);
	imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
	imageView.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

	return imageView;
}
 
开发者ID:liningwang,项目名称:camera,代码行数:11,代码来源:PictrueView.java

示例8: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			MediaLocTime mlt = mltArray.get(position);
			
            ImageView i = new ImageView(context);
            
			if(mlt.isClean(context))
			{
	            Bitmap b = mltArray.get(position).getActualBitmap(context);

	            i.setImageBitmap(b);
	            i.setScaleType(ImageView.ScaleType.CENTER);
	            
//	            LayoutParams layoutParams = new Gallery.LayoutParams((int) (b.getWidth() * WEIRD_LAYOUT_WIDTH_MULTIPLIER),
//	            		b.getHeight());
//	            i.setLayoutParams(layoutParams);
			}
			else
			{
	            LayoutParams layoutParams = new Gallery.LayoutParams(0, 100);
	            i.setLayoutParams(layoutParams);
	            
	            if(!mlt.isDeleted())
	            	GTG.mediaLocTimeMap.notifyMltNotClean(mlt);
			}
            
            return i;
		}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:29,代码来源:FullMediaGalleryActivity.java

示例9: makeView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public View makeView() {
    ImageView i = new ImageView(this);
    i.setBackgroundColor(0xFF000000);
    i.setScaleType(ImageView.ScaleType.FIT_CENTER);
    i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT));
    return i;
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:9,代码来源:ImageSwitcher1.java

示例10: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView i = new ImageView(mContext);

    i.setImageResource(mThumbIds[position]);
    i.setAdjustViewBounds(true);
    i.setLayoutParams(new Gallery.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    i.setBackgroundResource(R.drawable.picture_frame);
    return i;
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:11,代码来源:ImageSwitcher1.java

示例11: addView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
public int addView(View item){
	int                  currentPosition = 0;
	Size                 curSize         = null;
	Gallery.LayoutParams lParams         = null;
	
	if(mViewList == null){
		mViewList = new ArrayList<View>();
	}
	if(mOrgViewSizeList == null){
		mOrgViewSizeList = new HashMap<Integer,Size>();
	}
	
	//保存原始宽高信息
	lParams = (Gallery.LayoutParams) item.getLayoutParams();
	if(lParams != null){
		curSize = new Size(lParams.width, lParams.height);
	}else{
		curSize = new Size(LayoutParams.WRAP_CONTENT , LayoutParams.WRAP_CONTENT);
	}
	mOrgViewSizeList.put(mViewList.size() - 1, curSize);
	//添加进元素列表
	mViewList.add(item);
	if(lParams != null){
		//计算自适应
		if (CSStaticData.DEBUG)
			Log.w(TAG,"[addView]元素 " + mViewList.size() + " 开始自适应");
		if(mAutoAdjustEnable){
			if(mScaleRateWidth != 1f)
				curSize.setWidth((int)(curSize.getWidth()*mScaleRateWidth));
			if(mScaleRateHeight != 1f)
				curSize.setHeight((int)(curSize.getHeight()*mScaleRateHeight));
		}
		//宽度减半
		if(mDimension){
			if (CSStaticData.DEBUG)
				Log.w(TAG,"[addView]元素 " + mViewList.size() + " 开始3D模式调整");
			curSize.setWidth(curSize.getWidth()/2);
		}
		//设定新的宽高
		item.setLayoutParams(new Gallery.LayoutParams(curSize.getWidth(), curSize.getHeight()));
	}
	//准备函数返回值
	currentPosition = mViewList.indexOf(item); //替换成mViewList.size() - 1效率会更高,但这里要确保一个验证工作
	
	notifyDataSetChanged();
	return currentPosition;
}
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:48,代码来源:CSGalleryAdapter.java

示例12: getView

import android.widget.Gallery.LayoutParams; //导入依赖的package包/类
@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) 
	{
		/*
		 * 动态生成每个下拉项对应的View,每个下拉项View由LinearLayout
		 *中包含一个ImageView及一个TextView构成
		*/
		//初始化LinearLayout
		LinearLayout ll=new LinearLayout(context_Activity);
		ll.setOrientation(LinearLayout.HORIZONTAL);		//设置朝向	
		if(arg0 %2 == 0) 
		{
			ll.setBackgroundColor(context_Activity.getResources().getColor(R.color.listbgColor1));
		}
		else
			ll.setBackgroundColor(context_Activity.getResources().getColor(R.color.listbgColor2));
		ll.setPadding(5,5,5,5);//设置四周留白			
		//初始化ImageView
		ImageView  ii=new ImageView(context_Activity);
		ii.setImageDrawable(context_Activity.getResources().getDrawable(R.drawable.site_icon));//设置图片
		ii.setScaleType(ImageView.ScaleType.FIT_XY);
		ii.setLayoutParams(new Gallery.LayoutParams(60,40));
		ll.setVerticalGravity(Gravity.CENTER);
		ll.addView(ii);//添加到LinearLayout中
		//初始化TextView
		LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		//lp.setMargins(0, 0, 60, 0);
		LinearLayout ll_text=new LinearLayout(context_Activity);		
		
		lp.weight=150;
		ll_text.setLayoutParams(lp);
		ll_text.setWeightSum(1);
		ll_text.setOrientation(LinearLayout.VERTICAL);		//设置朝向	
		TextView tv=new TextView(context_Activity);
		String tempnane = msgIds.get(arg0).name;
//		if(tempnane.length()>9)
//		{
//			tempnane =tempnane.substring(0, 9);
//			tempnane =tempnane+"...";
//		}
		tv.setText(tempnane);//设置内容
	
		tv.setTextSize(18);//设置字体大小
		tv.setTextColor(context_Activity.getResources().getColor(R.color.ListTextColor));//设置字体颜色
		tv.setPadding(5,5,5,5);//设置四周留白
	    tv.setGravity(Gravity.LEFT);
	    
	    TextView tv_1=new TextView(context_Activity);//设定距离
	   String tempadd = msgIds.get(arg0).name;
//		if(tempadd.length()>11)
//			tempadd =tempadd.substring(0, 11)+"...";
	    tv_1.setText("地址: "+tempadd);//设置内容
	    tv_1.setTextSize(12);//设置字体大小
	    tv_1.setTextColor(context_Activity.getResources().getColor(R.color.Sites_distanct_TextColor));//设置字体颜色
	    tv_1.setPadding(5,0,0,0);//设置四周留白
	    
	    ll_text.addView(tv);
	    ll_text.addView(tv_1);
		ll.addView(ll_text);//添加到LinearLayout中		
		
		LinearLayout ll_love=new LinearLayout(context_Activity);
		ll_love.setOrientation(LinearLayout.VERTICAL);		//设置朝向			
		ll_love.setWeightSum(2);
		ImageView  i_love=new ImageView(context_Activity);
		if(arg0%5==0 ||arg0%7==0)
		i_love.setImageDrawable(context_Activity.getResources().getDrawable(R.drawable.love));//设置图片
		else {
			i_love.setImageDrawable(context_Activity.getResources().getDrawable(R.drawable.loved));//设置图片
		}
		i_love.setScaleType(ImageView.ScaleType.FIT_XY);
		i_love.setLayoutParams(new Gallery.LayoutParams(42,42));
		i_love.setPadding(5, 5, 5, 5);
		ll.addView(i_love);
		ll.addView(ll_love);//添加到LinearLayout中
		
		return ll;
	}
 
开发者ID:yulingtianxia,项目名称:ChangYou,代码行数:78,代码来源:BaseAdapter_search.java


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