Saturday, May 12, 2012

[android-developers] Image scaled, scroll, zoom, without margin

Hi,

A very easy thing, I thought.

Have an image : exp1.png, which I want to fit the screen in landscape or portrait, and wish that the user can scroll this image.

Tell me please, if I do that correctly :

1. I did copy different resolution in xhdpi (1024x....) hdpi(640x....) and ldpi,mdpi(480x...)
---->first warning/error : 

2. Have a Layout like this :
<ScrollView android:id="@+id/scrollView1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<ImageView android:id="@+id/exp1_image" android:src="@drawable/exp1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scaleType="centerInside" />

</ScrollView>

3. Have a class like this:
public class ImageActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ImageView image = (ImageView) findViewById(R.id.exp1_image);
    }
}

a. In portrait mode I have "margin" up and down (black screen), the image does not fit the screen. I don't know hot to set the title of the image (Image).
b. In landscape mode : the image is centered and not scaled, I have margin left and right

I cant zoom in the image. Scrolling is very good

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate