public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.choose_yinyang);
   yin = (ImageView) findViewById(R.id.yin);
   yang = (ImageView) findViewById(R.id.yang);
   next = (ImageView) findViewById(R.id.next);
   YTtfHelper.applyFont(this, findViewById(R.id.text), "mainfont.ttf");
   yin.setAdjustViewBounds(true);
   yang.setAdjustViewBounds(true);
   clearSelected();
   yin.setOnClickListener(this);
   yang.setOnClickListener(this);
   next.setOnClickListener(this);
   LevelConfig.TOOL_NUM[2]++;
 }
Exemplo n.º 2
0
  public LinearLayout crearImagen(Bitmap bitmap, final int nIdFoto) {
    ImageView ivImagen = new ImageView(this);

    LinearLayout linear_contenedorRegistro = (LinearLayout) new LinearLayout(this);
    linear_contenedorRegistro.setOrientation(LinearLayout.HORIZONTAL);
    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lp.setMargins(0, 0, 0, 0);
    lp.weight = 1;
    linear_contenedorRegistro.setLayoutParams(lp);
    linear_contenedorRegistro.setPadding(2, 2, 2, 2);

    if (bitmap != null) {
      // android:adjustViewBounds
      ivImagen.setImageBitmap(RotateBitmap(bitmap, 90));
      ivImagen.setAdjustViewBounds(true);

      ivImagen.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
              // TODO Auto-generated method stub
              irPreview(nIdFoto);
            }
          });
    }

    linear_contenedorRegistro.addView(ivImagen);

    return linear_contenedorRegistro;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View grid;
    LayoutInflater inflater =
        (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) {

      grid = new View(mContext);
      grid = inflater.inflate(R.layout.poster_grid_cell, null);
      ImageView imageView = (ImageView) grid.findViewById(R.id.posterthumb);
      imageView.setAdjustViewBounds(true);
      // Toast.makeText(mContext, "URL is " + movies[position], Toast.LENGTH_SHORT).show();
      Picasso.with(mContext)
          .load("http://image.tmdb.org/t/p/w500" + movies[position])
          .into(imageView);
      /*imageView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Log.d("click", "click");


          }
      });*/

    } else {
      grid = (View) convertView;
    }

    return grid;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View view = convertView;
      String pkg_name = display_process.get(position).processName;

      if (view == null) {
        LayoutInflater inflater = getLayoutInflater();
        view = inflater.inflate(R.layout.tablerow, parent, false);
      }

      TextView bottom_label = (TextView) view.findViewById(R.id.bottom_view);
      TextView top_label = (TextView) view.findViewById(R.id.top_view);
      ImageView icon = (ImageView) view.findViewById(R.id.row_image);
      icon.setAdjustViewBounds(true);
      icon.setMaxHeight(40);

      top_label.setText(parse_name(pkg_name));
      bottom_label.setText(
          String.format(
              "%s, pid: %d",
              display_process.get(position).processName, display_process.get(position).pid));

      try {
        icon.setImageDrawable(pk.getApplicationIcon(pkg_name));
      } catch (NameNotFoundException e) {
        icon.setImageResource(R.drawable.processinfo);
      }

      return view;
    }
Exemplo n.º 5
0
  public void DrawLevel(LinearLayout layoutLevel, int lv) {
    if (layoutLevel != null) layoutLevel.removeAllViews();
    String str = "" + lv;
    String[] arr = str.split("");

    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    for (int i = 0; i < arr.length; i++) {
      ImageView img = new ImageView(this);
      img.setLayoutParams(params);
      img.setAdjustViewBounds(true);
      if (arr[i].equals("0")) img.setImageResource(R.drawable.chairman_0);
      else if (arr[i].equals("1")) img.setImageResource(R.drawable.chairman_1);
      else if (arr[i].equals("2")) img.setImageResource(R.drawable.chairman_2);
      else if (arr[i].equals("3")) img.setImageResource(R.drawable.chairman_3);
      else if (arr[i].equals("4")) img.setImageResource(R.drawable.chairman_4);
      else if (arr[i].equals("5")) img.setImageResource(R.drawable.chairman_5);
      else if (arr[i].equals("6")) img.setImageResource(R.drawable.chairman_6);
      else if (arr[i].equals("7")) img.setImageResource(R.drawable.chairman_7);
      else if (arr[i].equals("8")) img.setImageResource(R.drawable.chairman_8);
      else if (arr[i].equals("9")) img.setImageResource(R.drawable.chairman_9);
      layoutLevel.addView(img);
    }
  }
  private void addIconTabBådeTekstOgBillede(
      final int position, int resId, Bitmap res, String title) {
    FrameLayout tabfl = new FrameLayout(getContext());
    if (Build.VERSION.SDK_INT > 11) tabfl.setLayoutTransition(new LayoutTransition());
    ImageView tabi = new ImageView(getContext());
    tabi.setContentDescription(title);
    if (res != null) {
      tabi.setImageBitmap(res);
      tabi.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
      tabi.setAdjustViewBounds(true);
    } else {
      tabi.setImageResource(resId);
    }
    tabi.setVisibility(View.GONE);
    TextView tabt = new TextView(getContext());
    tabt.setText(title);
    tabt.setTypeface(App.skrift_gibson);
    tabt.setGravity(Gravity.CENTER);
    tabt.setSingleLine();

    tabfl.addView(tabi);
    tabfl.addView(tabt);

    LayoutParams lp = (LayoutParams) tabi.getLayoutParams();
    lp.gravity = Gravity.CENTER;
    lp = (LayoutParams) tabt.getLayoutParams();
    lp.width = lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
    lp.gravity = Gravity.CENTER;

    addTab(position, tabfl);
  }
Exemplo n.º 7
0
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "Test {@link ImageView#setAdjustViewBounds(boolean)}",
        method = "setAdjustViewBounds",
        args = {boolean.class}
    )
    public void testSetAdjustViewBounds() {
        ImageView imageView = new ImageView(mActivity);
        imageView.setScaleType(ScaleType.FIT_XY);

        imageView.setAdjustViewBounds(false);
        assertEquals(ScaleType.FIT_XY, imageView.getScaleType());

        imageView.setAdjustViewBounds(true);
        assertEquals(ScaleType.FIT_CENTER, imageView.getScaleType());
    }
Exemplo n.º 8
0
 public Object instantiateItem(ViewGroup container, final int position) {
   ImageView image = new ImageView(getContext());
   image.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
   image.setAdjustViewBounds(false);
   image.setScaleType(ImageView.ScaleType.FIT_XY);
   final AQuery aq = new AQuery(image);
   if (m_mode == MODE.ASYNC) {
     AQueryHelper qh =
         new AQueryHelper(aq, image, imagesArray.get(position))
             .failDrawable(R.drawable.placeholder_big);
     qh.loadImage();
   } else {
     InputStream ims = null;
     try {
       ims = getResources().getAssets().open(imagesArray.get(position));
     } catch (IOException e) {
       e.printStackTrace();
     }
     // load image as Drawable
     Drawable d = Drawable.createFromStream(ims, null);
     // set image to ImageView
     image.setImageDrawable(d);
   }
   container.addView(image, 0);
   return image;
 }
Exemplo n.º 9
0
 @Override
 public void setAdjustViewBounds(boolean adjustViewBounds) {
   super.setAdjustViewBounds(adjustViewBounds);
   if (adjustViewBounds) {
     throw new IllegalArgumentException("adjustViewBounds not supported.");
   }
 }
Exemplo n.º 10
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.comment);

    final EditText edt = (EditText) findViewById(R.id.editText1);
    TextView t = (TextView) findViewById(R.id.textView1);
    Button b = (Button) findViewById(R.id.button1);
    Bundle extra = getIntent().getExtras();

    t.setText((extra.getString("user") + ":\n" + extra.getString("update")));
    ImageView iv = (ImageView) findViewById(R.id.imageView1);
    final Main imageGetter = new Main();
    Bitmap bmp = imageGetter.getImageFromWeb(imageGetter.webRoot + extra.getString("pic"));
    iv.setImageBitmap(bmp);
    iv.setAdjustViewBounds(true);
    iv.setMaxHeight(120);
    iv.setMaxWidth(120);

    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Toast.makeText(getApplicationContext(), edt.getText(), Toast.LENGTH_LONG).show();
          }
        });
  }
Exemplo n.º 11
0
  private ImageView initializeImageView() {
    ImageView image;
    image = new ImageView(this.activity);
    image.setId(IMAGE_ID);
    image.setAdjustViewBounds(true);
    image.setScaleType(this.style.imageScaleType);

    // set the image drawable if not null
    if (null != this.style.imageDrawable) {
      image.setImageDrawable(this.style.imageDrawable);
    }

    // set the image resource if not 0. This will overwrite the drawable
    // if both are set
    if (this.style.imageResId != 0) {
      image.setImageResource(this.style.imageResId);
    }

    RelativeLayout.LayoutParams imageParams =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    imageParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);

    image.setLayoutParams(imageParams);

    return image;
  }
Exemplo n.º 12
0
  private View createImageView(Context context, AssetManager am) {
    String[] imageFiles = {LOADING_ANDROID_PNG, LOADING_PNG};
    for (String imageFile : imageFiles) {
      InputStream is = null;
      try {
        is = am.open(imageFile);
        Bitmap bitmap = BitmapFactory.decodeStream(is);

        ImageView view = new ImageView(context);
        view.setImageBitmap(bitmap);
        view.setAdjustViewBounds(false);

        return view;
      } catch (IOException e) {
        if (DEBUG) Log.d(TAG, "Can't load " + imageFile, e);
      } finally {
        if (is != null)
          try {
            is.close();
          } catch (IOException e) {
          }
      }
    }

    return null;
  }
Exemplo n.º 13
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub

    ImageView imageView;
    if (convertView == null) {
      imageView = new ImageView(context);
      imageView.setLayoutParams(new GridView.LayoutParams(200, 200));
      imageView.setAdjustViewBounds(false);
      imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      imageView.setPadding(2, 2, 2, 2);
    } else {
      imageView = (ImageView) convertView;
    }
    /*
     * if(convertView == null){ convertView =
     * inflater.inflate(R.layout.gridview_album, parent ,false); }
     */

    // ImageView imgAlbum = (ImageView) convertView.findViewById(R.id.imgAlbum);

    Log.d("aaaa", "AlbumAdapter 훈련사진 URL은 " + albumURL.get(position));
    // Glide.with(convertView.getContext()).load(albumURL.get(position)).into(imgAlbum);
    Glide.with(context).load(albumURL.get(position)).into(imageView);
    return imageView;
  }
Exemplo n.º 14
0
  @Override
  public View getView(final int position, View view, ViewGroup arg2) {
    ViewHolder viewHolder = null;
    final ContactSortModel item = (ContactSortModel) getItem(position);
    if (view == null) {
      viewHolder = new ViewHolder();
      view = LayoutInflater.from(mContext).inflate(R.layout.contact_item, null);
      viewHolder.tvTitle = (TextView) view.findViewById(R.id.title);
      viewHolder.tvLetter = (TextView) view.findViewById(R.id.catalog);
      view.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) view.getTag();
    }

    // 根据position获取分类的首字母的Char ascii值
    int section = getSectionForPosition(position);

    // 如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现
    if ("添加好友".equals(item.getRoster().getAlias()) || "新朋友".equals(item.getRoster().getAlias())) {
      viewHolder.tvLetter.setVisibility(View.GONE);
    } else if (position == getPositionForSection(section)) {
      viewHolder.tvLetter.setVisibility(View.VISIBLE);
      viewHolder.tvLetter.setText(item.getSortLetters());

    } else {
      viewHolder.tvLetter.setVisibility(View.GONE);
    }

    viewHolder.tvTitle.setText(item.getRoster().getAlias());

    ImageView image = (ImageView) view.findViewById(R.id.iv_icon); // 获得ImageView对象
    viewHolder.tvImage = image;
    if ("添加好友".equals(item.getRoster().getAlias())) {
      viewHolder.tvImage.setBackgroundResource(R.drawable.contact_add_friends);
    } else if ("新朋友".equals(item.getRoster().getAlias())) {
      viewHolder.tvImage.setBackgroundResource(R.drawable.contact_new_friends);
    } else {
      viewHolder.tvImage.setBackgroundResource(R.drawable.default_mobile_avatar);

      File file = new File("mnt/sdcard/Wanglai/Avatar/" + item.getRoster().getJid() + ".png");
      if (file.exists()) {
        Bitmap bitmap =
            getLoacalBitmap(
                "mnt/sdcard/Wanglai/Avatar/" + item.getRoster().getJid() + ".png"); // 从本地取图片vcard
        // 设置Bitmap
        image.setImageBitmap(bitmap);
        // 设置Imageview
        image.setAdjustViewBounds(true);
        image.setMaxHeight(60);
        image.setMaxWidth(60);
        viewHolder.tvImage = image;
        viewHolder.tvImage.setBackgroundResource(0);
      }
    }

    return view;
  }
Exemplo n.º 15
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView = new ImageView(context);
    Glide.with(context).load(urlList.get(position)).placeholder(R.drawable.bg_test).into(imageView);

    imageView.setAdjustViewBounds(true);

    return imageView;
  }
Exemplo n.º 16
0
    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;
    }
Exemplo n.º 17
0
 public View getView(int position, View convertView, ViewGroup parent) {
   ImageView i = new ImageView(mContext);
   i.setFocusable(true);
   i.setFocusableInTouchMode(true);
   i.setImageResource(myCards[position]);
   i.setScaleType(ImageView.ScaleType.FIT_XY);
   i.setAdjustViewBounds(true);
   i.bringToFront();
   return i;
 }
Exemplo n.º 18
0
 public void run() {
   titleIcon.setAdjustViewBounds(true);
   titleIcon.setMaxHeight(viewSize);
   titleIcon.setMaxWidth(viewSize);
   titleIcon.setMinimumHeight(viewSize);
   titleIcon.setMinimumWidth(viewSize);
   titleIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
   titleIcon.setImageBitmap(bitmap);
   menuIconAnimation(titleIcon);
 }
Exemplo n.º 19
0
  @Override
  public void bindView(View view, Context context, Cursor cursor) {
    Movie movie = ParserCursorObj.cursorToMovie(cursor);

    ImageView imageView = (ImageView) view.findViewById(R.id.movies_grid_imageView);

    imageView.setAdjustViewBounds(true);
    Picasso.with(mContext)
        .load("http://image.tmdb.org/t/p/w185" + movie.getPosterPath())
        .into(imageView);
  }
Exemplo n.º 20
0
  private void setView() {
    ImageView image = new ImageView(this);
    Log.d(TAG, "new image view created");
    mBitmap = getBitmap(R.drawable.alto_ipiranga);
    image.setImageBitmap(mBitmap);
    Log.d(TAG, "bitmap height: " + mBitmap.getHeight());
    image.setAdjustViewBounds(true);
    image.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    setContentView(image);
  }
Exemplo n.º 21
0
 /** apply adjustBounds property in ImageView */
 public static void applyAdjustBounds(View view, DynamicProperty property) {
   if (view instanceof ImageView) {
     switch (property.type) {
       case BOOLEAN:
         {
           ((ImageView) view).setAdjustViewBounds(property.getValueBoolean());
         }
         break;
     }
   }
 }
  /** Lancement d'un rechargement du flux */
  private void launchReload(GeekIncRssListActivity activity) {
    instantiateAndShowProgressDialog(activity, 0);

    ImageView img = (ImageView) activity.findViewById(R.id.geekIncHDLogo);
    img.setAdjustViewBounds(true);
    int width = (int) (activity.getResources().getDisplayMetrics().density * 100 + 0.5f);
    img.setMaxWidth(width);

    ProgressTask task = new ProgressTask(activity, width);
    task.execute();
    listData.setTask(task);
  }
  @Override
  protected void onPostExecute(ArrayList<String> imageUrlStrings) {
    super.onPostExecute(imageUrlStrings);
    LinearLayout ll = (LinearLayout) activity.findViewById(R.id.displayActivityLayout);

    for (int i = 0; i < imageUrlStrings.size(); i++) {
      String urlString = imageUrlStrings.get(i);
      ImageView iv = new ImageView(activity);
      ll.addView(iv);
      Picasso.with(activity).load(urlString).into(iv);
      if (i % 2 == 0) {
        iv.getLayoutParams().height = 1800;
        iv.getLayoutParams().width = 1800;
        iv.setAdjustViewBounds(true);
      } else {
        iv.getLayoutParams().height = 900;
        iv.getLayoutParams().width = 900;
        iv.setAdjustViewBounds(true);
      }
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see android.widget.ViewSwitcher.ViewFactory#makeView()
   */
  @Override
  public View makeView() {
    ImageView i = new ImageView(this);
    i.setAdjustViewBounds(true);
    i.setScaleType(ImageView.ScaleType.FIT_CENTER);
    i.setLayoutParams(
        new ImageSwitcher.LayoutParams(
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT));

    return i;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bio);
    Resources res = getResources();
    Biography = res.getStringArray(R.array.biographyc20);
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);
    myToolbar.setSubtitle(R.string.c20);
    assert getSupportActionBar() != null;
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ListAdapter theAdapter = new bioadapter(this, Biography);
    final ListView wirdlist = (ListView) findViewById(R.id.biolist);
    wirdlist.setAdapter(theAdapter);
    registerForContextMenu(wirdlist);
    ListAdapter listAdapter = wirdlist.getAdapter();
    ImageView a = new ImageView(this);
    a.setImageResource(R.drawable.bio1);
    wirdlist.addHeaderView(a, null, false);
    a.setScaleType(ImageView.ScaleType.FIT_START);
    a.setAdjustViewBounds(true);
    ImageView b = new ImageView(this);
    b.setImageResource(R.drawable.gmsbtn);
    wirdlist.addFooterView(b);
    b.setScaleType(ImageView.ScaleType.FIT_START);
    b.setAdjustViewBounds(true);
    b.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            Uri uri =
                Uri.parse(
                    "http://www.greenmountainschool.org"); // missing 'http://' will cause crashed
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
          }
        });
  }
 @Override
 public void onHandleScreenshot(Bitmap screenshot) {
   if (screenshot != null) {
     mScreenshot.setImageBitmap(screenshot);
     mScreenshot.setAdjustViewBounds(true);
     mScreenshot.setMaxWidth(screenshot.getWidth() / 3);
     mScreenshot.setMaxHeight(screenshot.getHeight() / 3);
     mFullScreenshot.setImageBitmap(screenshot);
   } else {
     mScreenshot.setImageDrawable(null);
     mFullScreenshot.setImageDrawable(null);
   }
 }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      if (convertView == null) {
        convertView = new ImageView(SetBgActivity.this);
      }
      ImageView i = (ImageView) convertView;

      i.setImageResource(mThumbIds[position]);
      i.setAdjustViewBounds(true);
      i.setLayoutParams(
          new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      i.setScaleType(ScaleType.FIT_XY);
      return i;
    }
Exemplo n.º 28
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      ImageView imageView;
      if (convertView == null) {
        imageView = new ImageView(PicContainerActivity.this);
        imageView.setLayoutParams(
            new GridView.LayoutParams(IMAGE_VIEW_WIDTH, IMAGE_VIEW_WIDTH)); //
        imageView.setAdjustViewBounds(false);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);
      } else {
        imageView = (ImageView) convertView;
      }

      if (!readonly && position == imageFileUriList.size()) {
        imageView.setImageResource(R.drawable.add_camera);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                showPopupWindow(v);
              }
            });
      } else {
        final FileEntity image = (FileEntity) this.getItem(position);
        imageView.setBackgroundResource(0);
        if (image.getFileUri() != null) {
          imageView.setImageBitmap(
              FileHelper.decodeFile(image.getFileUri(), true, IMAGE_VIEW_WIDTH, IMAGE_VIEW_WIDTH));
        } else {
          ImageLoader.getInstance().displayImage(image.getAliasName(), imageView, true);
        }

        imageView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                Intent intent = new Intent(PicContainerActivity.this, ImagePreviewActivity.class);
                intent.putExtra(ImagePreviewActivity.IMAGE_SRC_KEY, image);
                intent.putExtra(ImagePreviewActivity.IMAGE_INDEX_IN_CONTAINER, position);
                intent.putExtra(ImagePreviewActivity.IMAGE_DELETE_FLAG, !readonly);

                PicContainerActivity.this.startActivityForResult(
                    intent, PREVIEW_IMAGE_ACTIVITY_REQUEST_CODE);
              }
            });
      }
      return imageView;
    }
  @Override
  public View newView(Context context, Cursor cursor, ViewGroup parent) {

    ImageView imageView = new ImageView(context);

    imageView.setLayoutParams(
        new GridView.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    imageView.setAdjustViewBounds(true);
    imageView.setScaleType(ImageView.ScaleType.FIT_XY);
    imageView.setBackgroundColor(Color.BLACK);
    imageView.setPadding(0, 0, 0, 0);

    return imageView;
  }
Exemplo n.º 30
0
    public CardboardOverlayEyeView(Context context, AttributeSet attrs) {
      super(context, attrs);
      imageView = new ImageView(context, attrs);
      imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
      imageView.setAdjustViewBounds(true); // Preserve aspect ratio.
      //            imageView.setImageResource(R.drawable.crosshair);
      addView(imageView);

      textView = new TextView(context, attrs);
      textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14.0f);
      textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
      textView.setGravity(Gravity.CENTER);
      textView.setShadowLayer(3.0f, 0.0f, 0.0f, Color.DKGRAY);
      addView(textView);
    }