May 22, 2012

Display image in full size

In the former articles in Image processing on Android series, the image is displayed in shrinked version to suit the device's screen. It's modified display in scrollable true size.

Display big image in full size


Modify the layout, main.xml, to embed the ImageViews inside nested HorizontalScrollView and ScrollView. Such that the ImageViews will be displayed in full-size and scrollable.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
    
    <HorizontalScrollView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content">
     <ScrollView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content">
         <LinearLayout 
             android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical" >
          <TextView
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="Original" />
       <ImageView
           android:id="@+id/imageSource" 
           android:layout_width="wrap_content"
           android:layout_height="wrap_content" 
           android:scaleType="center"
           android:src="@drawable/testpicture"/>
       <TextView
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="Result" />
       <FrameLayout 
           android:layout_width="wrap_content"
           android:layout_height="wrap_content">
           <ImageView
               android:id="@+id/imageAfter" 
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:scaleType="center"/>
           <ProgressBar
               android:id="@+id/progressBar"
               style="?android:attr/progressBarStyleLarge"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"/>
       </FrameLayout>
      
      </LinearLayout>
     </ScrollView>
 </HorizontalScrollView>

</LinearLayout>



No comments:

Post a Comment

Infolinks In Text Ads