Java 类android.widget.Gallery.LayoutParams 实例源码

项目:WiCamera3D    文件:CSGalleryAdapter.java   
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;
}
项目:AndroidOpenSource    文件:GalleryAdapter.java   
@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;
}
项目:12306-android-Decompile    文件:i.java   
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();
  }
}
项目:12306-android-Decompile    文件:m.java   
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();
  }
}
项目:12306-android-Decompile    文件:i.java   
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();
  }
}
项目:12306-android-Decompile    文件:m.java   
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();
  }
}
项目:buildAPKsSamples    文件:Wallpaper.java   
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;
}
项目:camera    文件:PictrueView.java   
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;
}
项目:camera    文件:PictrueView.java   
@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;
}
项目:TinyTravelTracker    文件:FullMediaGalleryActivity.java   
@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;
        }
项目:ApiDemos    文件:ImageSwitcher1.java   
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;
}
项目:ApiDemos    文件:ImageSwitcher1.java   
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;
}
项目:Home    文件:Wallpaper.java   
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;
}
项目:plustwo    文件:Wallpaper.java   
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;
}
项目:MEng    文件:ImageSwitcher1.java   
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;
}
项目:MEng    文件:ImageSwitcher1.java   
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;
}
项目:codeexamples-android    文件:ImageSwitcher1.java   
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;
}
项目:codeexamples-android    文件:ImageSwitcher1.java   
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;
}
项目:deview-2013-samples    文件:ImageSwitcher1.java   
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;
}
项目:deview-2013-samples    文件:ImageSwitcher1.java   
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;
}
项目:WiCamera3D    文件:CSGalleryAdapter.java   
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;
}
项目:ChangYou    文件:BaseAdapter_search.java   
@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;
    }