Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Thursday, August 9, 2012

Android - Placing Image Above Text in Button


Place the following in your layout XML file, replacing [image] with your image:
1
2
3
4
5
6
<Button
     android:id="@+id/groups_button_bg"
     android:layout_height="wrap_content"
     android:layout_width="wrap_content"
     android:text="Groups"
     android:drawableTop="@drawable/[image]" />
Using android:drawableTop="@drawable/...", we’re able to place an image abovethe button text. The following options are available for placing the image in different positions relative to the button text:
1
2
3
4
android:drawableLeft
android:drawableRight
android:drawableBottom
android:drawableTop
In addition, android:drawablePadding can be used to specify the amount of padding between the image and button text.

Sunday, April 29, 2012

Android - Open Gallery For Image

//Open Gallery To Select Image
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, 0);


//To Show Image After Selection or Get its Path
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent);

    switch(requestCode) {
    case 0:
        if(resultCode == RESULT_OK){ 
            Uri selectedImage = imageReturnedIntent.getData();
            String[] filePathColumn = {MediaStore.Images.Media.DATA};

            Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String filePath = cursor.getString(columnIndex); // file path of selected image
            cursor.close();
                   //  Convert file path into bitmap image using below line.
            Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);
          
                   // put  bitmapimage in your imageview
            yourimgView.setImageBitmap(yourSelectedImage);
        }
    }
}

Monday, February 13, 2012

iPhone/iPad Splash Screen File Names


Default File Names for Individual Orientation of Device:
  1. Default-Portrait.png
  2. Default-PortraitUpsideDown.png
  3. Default-Landscape.png
  4. Default-LandscapeLeft.png
  5. Default-LandscapeRight.png