Java 类android.widget.Gallery 实例源码

项目:YalpStore    文件:FullscreenImageActivity.java   
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    if (null == DetailsActivity.app) {
        Log.w(getClass().getSimpleName(), "No app stored");
        finish();
        return;
    }

    Gallery gallery = ((Gallery) findViewById(R.id.gallery));
    gallery.setAdapter(new FullscreenImageAdapter(
        this,
        DetailsActivity.app.getScreenshotUrls(),
        getWindowManager().getDefaultDisplay().getWidth(),
        getWindowManager().getDefaultDisplay().getHeight()
    ));
    gallery.setSelection(intent.getIntExtra(INTENT_SCREENSHOT_NUMBER, 0));
}
项目:YalpStore    文件:ImageAdapter.java   
@Override
protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);
    Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
    int w = screenWidth;
    int h = screenWidth;
    if (null != bitmap) {
        w = Math.min(w, bitmap.getWidth());
        h = Math.min(h, bitmap.getHeight());
    }
    imageView.setLayoutParams(new Gallery.LayoutParams(w, h));
    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    if (imageView.getParent() instanceof Gallery) {
        Gallery gallery = (Gallery) imageView.getParent();
        gallery.setMinimumHeight(Math.max(gallery.getMeasuredHeight(), h));
    }
}
项目:Grandroid2    文件:StateKeeper.java   
/**
 * 儲存view的值,需設定過tag
 *
 * @param obj view物件
 */
protected void save(View obj) {
    Editor editor = settings.edit();
    if (obj instanceof TextView) {
        editor.putString(obj.getTag().toString(), ((TextView) obj).getText().toString());
    } else if (obj instanceof EditText) {
        editor.putString(obj.getTag().toString(), ((EditText) obj).getText().toString()).commit();
    } else if (obj instanceof ListView) {
        editor.putInt(obj.getTag().toString(), ((ListView) obj).getFirstVisiblePosition()).commit();
    } else if (obj instanceof Gallery) {
        editor.putInt(obj.getTag().toString(), ((Gallery) obj).getFirstVisiblePosition()).commit();
    } else if (obj instanceof GridView) {
        editor.putInt(obj.getTag().toString(), ((GridView) obj).getFirstVisiblePosition()).commit();
    }
    editor.commit();
}
项目:Grandroid2    文件:StateKeeper.java   
/**
 * 載入該view前次的值,需設定過tag
 *
 * @param obj view物件
 * @return 回傳該載入的值,若沒有資料則為空字串(不是null)
 */
protected void load(View obj) {
    String tag = obj.getTag().toString();
    if (settings.contains(tag)) {
        if (obj instanceof TextView) {
            ((TextView) obj).setText(settings.getString(tag, ""));
        } else if (obj instanceof EditText) {
            ((EditText) obj).setText(settings.getString(tag, ""));
        } else if (obj instanceof ListView) {
            ((ListView) obj).setSelectionFromTop(settings.getInt(tag, 0), 0);
        } else if (obj instanceof Gallery) {
            ((Gallery) obj).setSelection(settings.getInt(tag, 0));
        } else if (obj instanceof GridView) {
            ((GridView) obj).setSelection(settings.getInt(tag, 0));
        }
    }
}
项目:camera    文件:PictrueView.java   
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    gallery = (Gallery) findViewById(R.id.gallery);
    bitmap = SDUtil.getImagePathFromSD(); 
    imageAdapter = new ImageAdapter(this, bitmap.size());
    gallery.setAdapter(imageAdapter);
    gallery.setOnItemSelectedListener(this);
    gallery.setSelection(1);// 璁剧疆涓�鍔犺浇Activity灏辨樉绀虹殑鍥剧墖涓虹浜屽紶

    gallery.setOnItemClickListener(this);

    iv = (ImageView) findViewById(R.id.iv);
    //imageSwitcher.setFactory(this);

    // 璁剧疆鍔ㄧ敾鏁堟灉 娣″叆娣″嚭
    //imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    //imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
}
项目:mobile-manager-tool    文件:GalleryAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

       /*产生ImageView对象*/
       ImageView view = new ImageView(context);
       /*设定图片给imageView对象*/
       Bitmap bm = BitmapFactory.decodeFile(images.get(position));

       view.setImageBitmap(bm);
       /*重新设定图片的宽高*/
       //view.setScaleType(ImageView.ScaleType.FIT_XY);
       /*重新设定Layout的宽高*/
       view.setLayoutParams(new Gallery.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

       return view;
}
项目:alternate-java-bridge-library    文件:ImageGallery.java   
/**
 * 
 * Sets an image to the background of the image gallery
 * 
 * @param image The name of the image
 */
public void BackgroundImage(String image) {
    String file;
    if (image.contains(".")) {
        file = image.split("\\.")[0];
    } else {
        file = image;
    }
    int img = container.$context().getResources().getIdentifier(file, "drawable", container.$form().getPackageName());
    if (resourceId!=-1) {
        ((Gallery) container.$form().findViewById(resourceId)).setBackgroundDrawable(container.$context().getResources().getDrawable(img));
    } else {
        view.setBackgroundDrawable(container.$context().getResources().getDrawable(img));
        view.requestLayout();
    }
}
项目: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;
}
项目:Android-Image-Cache-master    文件:InteractiveDemo.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final Gallery gallery = (Gallery) findViewById(R.id.gallery);

    mCache = ImageCache.getInstance(this);
    mCache.setCacheMaxSize(1 * 1024 /* mega */* 1024 /* kilo */);

    initData();

    setListAdapter(TestData.generateAdapter(this, mTestData, R.layout.thumbnail_item, mCache,
            320, 200));

    gallery.setAdapter(TestData.generateAdapter(this, mTestData, R.layout.small_thumbnail_item,
            mCache, 160, 100));
}
项目:FacialExpressionRecognizer    文件:Recognizer.java   
public Recognizer(final Activity parent, org.altervista.scarrozzo.facialexpressionrecognizer.util.FaceAdapter imgAdapt,
        Gallery faceGallery, ImageView faceView, String filePath,
        String[] progStr, Uri mCapturedImageURI) {
    this.parent = parent;
    this.imgAdapt = imgAdapt;
    this.faceGallery = faceGallery;
    this.faceView = faceView;
    this.filePath = filePath;
    this.progStr = progStr;
    this.ioError = null;
    this.mCapturedImageURI = mCapturedImageURI;

    this.expressions = new String[]{ parent.getResources().getString(R.string.exp_neutral), 
                                     parent.getResources().getString(R.string.exp_happy),
                                     parent.getResources().getString(R.string.exp_surprise),
                                     parent.getResources().getString(R.string.exp_anger),
                                     parent.getResources().getString(R.string.exp_fear),
                                     parent.getResources().getString(R.string.exp_sad),
                                     parent.getResources().getString(R.string.exp_disgust)
                                   };
    this.deleteFlag = false;
}
项目:ApiDemos    文件:Gallery1.java   
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {
        convertView = new ImageView(mContext);

        imageView = (ImageView) convertView;
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setLayoutParams(new Gallery.LayoutParams(
                (int) (ITEM_WIDTH * mDensity + 0.5f),
                (int) (ITEM_HEIGHT * mDensity + 0.5f)));

        // The preferred Gallery item background
        imageView.setBackgroundResource(mGalleryItemBackground);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mImageIds[position]);

    return imageView;
}
项目:ApiDemos    文件:Gallery2.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gallery_2);

    // Get a cursor with all people
    Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
            CONTACT_PROJECTION, null, null, null);
    startManagingCursor(c);

    SpinnerAdapter adapter = new SimpleCursorAdapter(this,
    // Use a template that displays a text view
            android.R.layout.simple_gallery_item,
            // Give the cursor to the list adatper
            c,
            // Map the NAME column in the people database to...
            new String[] {Contacts.DISPLAY_NAME},
            // The "text1" view defined in the XML template
            new int[] { android.R.id.text1 });

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(adapter);
}
项目:ApiDemos    文件:ImageSwitcher1.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
}
项目:4pdaClient-plus    文件:BbCodesBasePanel.java   
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        // Get a View to display image data
        convertView = new ImageView(this.myContext);

        ((ImageView) convertView).setScaleType(ImageView.ScaleType.FIT_END);
        // Set the Width & Height of the individual images
        convertView.setLayoutParams(new Gallery.LayoutParams((int) (m_Density * 30), (int) (m_Density * 30)));
    }

    try {
        ((ImageView) convertView).setImageBitmap(m_GetBitmapFunc.getBitmap(mContext, m_Images[position].FilePath));
        convertView.setTag(m_Images[position]);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return convertView;
}
项目:like_googleplus_layout    文件:GalleryFlowActivity.java   
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    if (null == convertView)
    {
        convertView = new MyImageView(GalleryFlowActivity.this);
        int width = (int) (80* getResources().getDisplayMetrics().density);
        int height = (int) (120* getResources().getDisplayMetrics().density);
        convertView.setLayoutParams(new Gallery.LayoutParams(width, height));
    }

    ImageView imageView = (ImageView) convertView;
    imageView.setImageDrawable(mBitmaps.get(position%mBitmaps.size()));
    imageView.setScaleType(ScaleType.FIT_XY);

    return imageView;
}
项目:itmarry    文件:ImageAdapter.java   
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
    // TODO Auto-generated method stub
    ImageView img = (ImageView)arg1;
    if(img == null) {
        img = new ImageView(mContext);
    }
    if( pic_string_id != null )
    {
        img.setImageDrawable(LoadImageMgr.getInstance().loadDrawble(pic_string_id.get(arg0), img, LoadImageMgr.getInstance().imageCallBack));
    }else
    {
        img.setImageDrawable(pic_array_id.get(arg0));
    }
    img.setLayoutParams(new Gallery.LayoutParams((int)mContext.getResources().getDimension(R.dimen.galley_high),
                                    (int)mContext.getResources().getDimension(R.dimen.galley_high)));
    return img;
}
项目:ChangYou    文件:NewsActivity.java   
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) 
{
    /*
     * 动态生成每个下拉项对应的View,每个下拉项View由LinearLayout
     *中包含一个ImageView及一个TextView构成
    */
    //初始化LinearLayout
    ll=new LinearLayout(context_Activity);
    ll.setOrientation(LinearLayout.HORIZONTAL);     //设置朝向      
    //初始化ImageView
    i_love=new ImageView(context_Activity);
    i_love.setImageDrawable(context_Activity.getResources().getDrawable(msgIds.get(arg0)));//设置图片
    i_love.setScaleType(ImageView.ScaleType.FIT_XY);
    i_love.setLayoutParams(new Gallery.LayoutParams(dm.widthPixels,dm.widthPixels*80/320));
    ll.addView(i_love);//添加到LinearLayout中
    return ll;
}
项目:EmopAndroid    文件:HotActivity.java   
@Override
public View getView(int index, View oldView, ViewGroup arg2) {
    // TODO Auto-generated method stub
    LinearLayout liner = new LinearLayout(HotActivity.this);
    liner.setBackgroundColor(getResources().getColor(R.color.color_hot_item));
    liner.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.FILL_PARENT,
            Gallery.LayoutParams.FILL_PARENT
            ));

    ImageView i = new ImageView (HotActivity.this); 
    i.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
            LinearLayout.LayoutParams.FILL_PARENT
            ));         
    i.setScaleType(ScaleType.CENTER_CROP);

    liner.addView(i);
    HashMap<String, Object> item = (HashMap<String, Object>)this.getItem(index);
    String url = (String)item.get("ItemImage");         
    client.appImgLoader.loadImage(url, i, winWidth, true);
    //client.appImgLoader.loadImage(url, i);

    return liner;  
}
项目:mockey    文件:PickBackgroundImagesActivity.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // create the view
    ImageView imageView = new ImageView(galleryContext);
    // specify the bitmap at this position in the array
    imageView.setImageBitmap(MyApplication.getInstance()
            .getBackgroundBitmap(position));
    // set layout options
    imageView.setLayoutParams(new Gallery.LayoutParams(300, 200));
    // scale type within view area
    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    // set default gallery item background
    imageView.setBackgroundResource(defaultItemBackground);
    // return the view
    return imageView;
}
项目:JDMall    文件:IndexActivity.java   
@Override
protected void findViewById() {
    // TODO Auto-generated method stub
    mIndexHour = (TextView) findViewById(R.id.index_miaosha_hour);
    mIndexMin = (TextView) findViewById(R.id.index_miaosha_min);
    mIndexSeconds = (TextView) findViewById(R.id.index_miaosha_seconds);
    mIndexPrice = (TextView) findViewById(R.id.index_miaosha_price);
    mIndexRawPrice = (TextView) findViewById(R.id.index_miaosha_raw_price);

    mMiaoShaImage = (ImageView) findViewById(R.id.index_miaosha_image);
    mViewPager = (JazzyViewPager) findViewById(R.id.index_product_images_container);
    mIndicator = (LinearLayout) findViewById(R.id.index_product_images_indicator);

    mStormGallery = (Gallery) findViewById(R.id.index_jingqiu_gallery);
    mPromotionGallery = (Gallery) findViewById(R.id.index_tehui_gallery);

    mSearchBox = (EditText) findViewById(R.id.index_search_edit);
    mSearchButton = (ImageButton) findViewById(R.id.index_search_button);
    mTopLayout = (LinearLayout) findViewById(R.id.index_top_layout);
}
项目:arduino2android    文件:HelpActivity.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    //create the view
    ImageView imageView = new ImageView(galleryContext);
    //specify the bitmap at this position in the array
    imageView.setImageBitmap(imageBitmaps[position]);
    //set layout options
    imageView.setLayoutParams(new Gallery.LayoutParams(300, 200));
    //scale type within view area
    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    //set default gallery item background
    imageView.setBackgroundResource(defaultItemBackground);
    //return the view
    return imageView;
}
项目:Field-Book    文件:GalleryImageAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        imageView = new ImageView(this.context);
        imageView.setPadding(3, 3, 3, 3);
        convertView = imageView;
        holder.imageView = imageView;
        convertView.setTag(holder);

    } else {

        holder = (ViewHolder) convertView.getTag();
    }

    holder.imageView.setImageDrawable(plotsImages.get(position));
    holder.imageView.setScaleType(ScaleType.FIT_CENTER);
    holder.imageView.setLayoutParams(new Gallery.LayoutParams(270, 450));

    return imageView;
}
项目:CMPUT301F13T08    文件:PicAdapter.java   
/**
    * get view specifies layout and display options for each thumbnail in the
    * gallery
    * 
    * @param position
    *            the index of the selected photo in the adapter
    * @param convertView
    *            the view that is going to be converted to user's desire
    * @param parent
    *            a ViewGroup object
    * @return the converted view for the Photo
    */
   public View getView(int position, View convertView, ViewGroup parent) {

/* create the view */
ImageView imageView = new ImageView(galleryContext);

/* specify the bitmap at this position in the array */
imageView.setImageBitmap(imageBitmaps[position]);

/* set layout options */
imageView.setLayoutParams(new Gallery.LayoutParams(300, 200));

/* scale type within view area */
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);

/* set default gallery item background */
imageView.setBackgroundResource(defaultItemBackground);

/* return the view */
return imageView;
   }
项目:ZalartAndroid    文件:AddReportView.java   
public AddReportView(Activity activity) {
    super(activity);

    mBtnPicture = (Button) activity.findViewById(R.id.btnPicture);
    mBtnAddCategory = (Button) activity.findViewById(R.id.add_category);
    mPickDate = (Button) activity.findViewById(R.id.pick_date);
    mPickTime = (Button) activity.findViewById(R.id.pick_time);
    mDeleteReport = (Button) activity.findViewById(R.id.delete_report);
    mLatitude = (EditText) activity.findViewById(R.id.incident_latitude);
    mLongitude = (EditText) activity.findViewById(R.id.incident_longitude);
    gallery = (Gallery) activity.findViewById(R.id.gallery);
    mIncidentTitle = (EditText) activity.findViewById(R.id.incident_title);
    mIncidentLocation = (EditText) activity
            .findViewById(R.id.incident_location);
    mIncidentDesc = (EditText) activity.findViewById(R.id.incident_desc);
    mNews = (EditText) activity.findViewById(R.id.report_news);
    mSwitcher = (ImageSwitcher) activity
            .findViewById(R.id.sel_image_switcher);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(activity,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(activity,
            android.R.anim.fade_out));

}
项目:MEng    文件:Gallery1.java   
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {
        convertView = new ImageView(mContext);

        imageView = (ImageView) convertView;
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setLayoutParams(new Gallery.LayoutParams(
                (int) (ITEM_WIDTH * mDensity + 0.5f),
                (int) (ITEM_HEIGHT * mDensity + 0.5f)));

        // The preferred Gallery item background
        imageView.setBackgroundResource(mGalleryItemBackground);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mImageIds[position]);

    return imageView;
}
项目:MEng    文件:Gallery2.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gallery_2);

    // Get a cursor with all people
    Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
            CONTACT_PROJECTION, null, null, null);
    startManagingCursor(c);

    SpinnerAdapter adapter = new SimpleCursorAdapter(this,
    // Use a template that displays a text view
            android.R.layout.simple_gallery_item,
            // Give the cursor to the list adatper
            c,
            // Map the NAME column in the people database to...
            new String[] {Contacts.DISPLAY_NAME},
            // The "text1" view defined in the XML template
            new int[] { android.R.id.text1 });

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(adapter);
}
项目:MEng    文件:ImageSwitcher1.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
}
项目:Fishification    文件:FeedFishFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    m_view = inflater.inflate(R.layout.fragment_fish_feed, container, false);
    m_defaultBackground = m_view.getBackground();

    // Init Gallery
    Gallery gallery = (Gallery) m_view.findViewById(R.id.fishBoxGallery);
    gallery.setAdapter(new FishFoodBoxAdapter(m_view.getContext()));

    // Init Sensor
    Context context = m_view.getContext();
    m_sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
    m_lastUpdate = System.currentTimeMillis();

    return m_view;
}
项目:codeexamples-android    文件:Gallery1.java   
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {
        convertView = new ImageView(mContext);

        imageView = (ImageView) convertView;
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setLayoutParams(new Gallery.LayoutParams(
                (int) (ITEM_WIDTH * mDensity + 0.5f),
                (int) (ITEM_HEIGHT * mDensity + 0.5f)));

        // The preferred Gallery item background
        imageView.setBackgroundResource(mGalleryItemBackground);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mImageIds[position]);

    return imageView;
}
项目:codeexamples-android    文件:Gallery2.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gallery_2);

    // Get a cursor with all people
    Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
            CONTACT_PROJECTION, null, null, null);
    startManagingCursor(c);

    SpinnerAdapter adapter = new SimpleCursorAdapter(this,
    // Use a template that displays a text view
            android.R.layout.simple_gallery_item,
            // Give the cursor to the list adatper
            c,
            // Map the NAME column in the people database to...
            new String[] {Contacts.DISPLAY_NAME},
            // The "text1" view defined in the XML template
            new int[] { android.R.id.text1 });

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(adapter);
}
项目:codeexamples-android    文件:ImageSwitcher1.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
}
项目:deview-2013-samples    文件:Gallery1.java   
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {
        convertView = new ImageView(mContext);

        imageView = (ImageView) convertView;
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setLayoutParams(new Gallery.LayoutParams(
                (int) (ITEM_WIDTH * mDensity + 0.5f),
                (int) (ITEM_HEIGHT * mDensity + 0.5f)));

        // The preferred Gallery item background
        imageView.setBackgroundResource(mGalleryItemBackground);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mImageIds[position]);

    return imageView;
}
项目:deview-2013-samples    文件:Gallery2.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gallery_2);

    // Get a cursor with all people
    Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
            CONTACT_PROJECTION, null, null, null);
    startManagingCursor(c);

    SpinnerAdapter adapter = new SimpleCursorAdapter(this,
    // Use a template that displays a text view
            android.R.layout.simple_gallery_item,
            // Give the cursor to the list adatper
            c,
            // Map the NAME column in the people database to...
            new String[] {Contacts.DISPLAY_NAME},
            // The "text1" view defined in the XML template
            new int[] { android.R.id.text1 });

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(adapter);
}
项目:deview-2013-samples    文件:ImageSwitcher1.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
}
项目:gundog-engine    文件:UpgradeRightLayout.java   
public void reset() {
    upgradeLayout = new LinearLayout(activity);
    upgradeLayout.setOrientation(LinearLayout.VERTICAL);

    ADS.placeObtrusiveADMobAD(upgradeLayout);
    selectionLayout = new LinearLayout(activity);
    selectionLayout.setOrientation(LinearLayout.VERTICAL);

    Gallery gallery = generateRaceSelectionLayout();
    upgradeLayout.addView(gallery);
    ImageView seperator = new ImageView(activity);
    seperator.setImageBitmap(BitmapCache.getBitmap(R.drawable.menu_seperator));
    upgradeLayout.addView(seperator);

    upgradeLayout.addView(selectionLayout);

}
项目:Joszolgalat_Android_App    文件:AddReportView.java   
public AddReportView(Activity activity) {
    super(activity);

    mBtnPicture = (Button) activity.findViewById(R.id.btnPicture);
    mBtnAddCategory = (Button) activity.findViewById(R.id.add_category);
    mPickDate = (Button) activity.findViewById(R.id.pick_date);
    mPickTime = (Button) activity.findViewById(R.id.pick_time);
    mDeleteReport = (Button) activity.findViewById(R.id.delete_report);
    mLatitude = (EditText) activity.findViewById(R.id.incident_latitude);
    mLongitude = (EditText) activity.findViewById(R.id.incident_longitude);
    gallery = (Gallery) activity.findViewById(R.id.gallery);
    mIncidentTitle = (EditText) activity.findViewById(R.id.incident_title);
    mIncidentLocation = (EditText) activity
            .findViewById(R.id.incident_location);
    mIncidentDesc = (EditText) activity.findViewById(R.id.incident_desc);
    mNews = (EditText) activity.findViewById(R.id.report_news);
    mSwitcher = (ImageSwitcher) activity
            .findViewById(R.id.sel_image_switcher);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(activity,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(activity,
            android.R.anim.fade_out));
    this.mapView = (MapView) activity.findViewById(R.id.location_map);
}
项目:buildAPKsSamples    文件:Wallpaper.java   
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.wallpaper);

    mGallery = (Gallery) findViewById(R.id.gallery);
    mGallery.setAdapter(new ImageAdapter(this));
    mGallery.setOnItemSelectedListener(this);
    mGallery.setOnItemClickListener(this);
}
项目: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;
}
项目:FaceAI_Android    文件:FaceActivity.java   
private void initViews() {
    mPhoto = (ImageView) findViewById(R.id.id_photo);
    mGetImage = (ImageButton) findViewById(R.id.id_getImage);
    mDetect = (TextView) findViewById(R.id.id_detect);
    // mTip = (TextView) findViewById(R.id.id_tip);
    mWaitting = findViewById(R.id.id_waiting);

    gallery = (Gallery) findViewById(R.id.id_gallery);
    imageSwitcher = (ImageSwitcher) findViewById(R.id.id_imageSwitcher);
    scrollView = (ScrollView) findViewById(R.id.scrollView1);
    scrollView.setVerticalScrollBarEnabled(false);

}
项目:FaceAI_Android    文件:MyImageAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ImageView imageView = new ImageView(context);
    imageView.setBackgroundResource(image[position % 13]);
    imageView.setLayoutParams(new Gallery.LayoutParams(400, 300));
    imageView.setScaleType(ScaleType.FIT_XY);

    return imageView;
}