0

I have to scroll the webview content vertically with in scrollview surrounded tag ,in the sense that webview hided initially and when touch event occured the webview contained have to visible the scroll control in both directions but its not scrolling vertically,anybody help me to solve it... here xml code

+++++++++++++++++++design at initial loading +++++++++++

                    </RelativeLayout>

++++++++++++++++Design being shown after click event occuered its visible and above part is hided-----------------

                android:layout_width="fill_parent" android:layout_height="fill_parent"
                android:layout_above="@+id/jr_lb_view_preview_gallery">
                <ProgressBar android:id="@+id/jr_lb_progress_small"
                    android:layout_centerInParent="true" android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:indeterminateDrawable="@drawable/pb" />
                <WebView android:id="@+id/jr_lb_view_preview_switcher"
                    android:layout_width="fill_parent" android:layout_height="fill_parent"
                    android:scrollbars="none" />
            </RelativeLayout>
                </LinearLayout>


                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent" android:layout_height="wrap_content"
                    android:layout_marginBottom="5dip" android:gravity="center">
                    <TextView android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:id="@+id/jr_lb_content_price"
                        android:textSize="12sp" android:textColor="@color/white"
                        android:background="@drawable/black_r_corner" android:typeface="sans" />
                    <TextView android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:text="Free Shipping!"
                        android:textSize="12sp" android:textColor="@color/author_color"
                        android:typeface="sans" android:layout_marginLeft="15dip" />

                </LinearLayout>
                <View android:layout_width="310dip" android:layout_height="1dip"
                    android:background="#FF909090" />

                <GridView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/jr_lb_summary_grid" android:layout_width="fill_parent"
                    android:layout_height="wrap_content" android:numColumns="4"
                    android:columnWidth="75dip" android:scrollbars="none"
                    android:gravity="center" android:listSelector="@drawable/corner_orange1"
                    android:layout_marginTop="5dip" />
                <View android:layout_width="310dip" android:layout_height="1dip"
                    android:background="#FF909090" />
                <TextView android:layout_width="fill_parent"
                    android:layout_height="wrap_content" android:text="Details"
                    android:textSize="20sp" android:textColor="@color/author_color"
                    android:typeface="sans" />
                <View android:layout_width="310dip" android:layout_height="1dip"
                    android:background="#FF909090" />
                <WebView android:id="@+id/jr_lb_content_tv"
                    android:textSize="15sp" android:textColor="@color/black"
                    android:layout_width="fill_parent" android:layout_height="fill_parent" />
            </LinearLayout>
        </ScrollView>
thelost
  • 6,638
  • 4
  • 28
  • 44
MGSenthil
  • 599
  • 2
  • 12
  • 25
  • refer this [tutorial](http://vinnysoft.blogspot.com/2009/08/zooming-imageview.html)... and also refer this question in [stackoverflow](http://stackoverflow.com/questions/2537238/how-can-i-get-zoom-functionality-for-images) try the code on those links... – Kandha Aug 23 '10 at 04:11

2 Answers2

0

Make a zoom class like this

import android.content.Context;

import android.graphics.Canvas;

import android.graphics.drawable.Drawable;

import android.view.KeyEvent;

import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;


public class Zoom extends View {


    private Drawable image;
    ImageButton img,img1;

    private int zoomControler=20;


    public Zoom(Context context)

    {

            super(context);

            image=context.getResources().getDrawable(R.drawable.j);
            //image=context.getResources().getDrawable(R.drawable.icon);

            setFocusable(true);



    }

    @Override

    protected void onDraw(Canvas canvas) {

            // TODO Auto-generated method stub

            super.onDraw(canvas);

    //here u can control the width and height of the images........ this line is very important

    image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler);

            image.draw(canvas);

    }


    @Override

    public boolean onKeyDown(int keyCode, KeyEvent event) {



            if(keyCode==KeyEvent.KEYCODE_DPAD_UP)// zoom in

                    zoomControler+=10;

            if(keyCode==KeyEvent.KEYCODE_DPAD_DOWN) // zoom out

                    zoomControler-=10;

            if(zoomControler<10)

                    zoomControler=10;



            invalidate();

            return true;

    }

And use it like

 setContentView(new Zoom(this));
Hybrid Developer
  • 2,320
  • 1
  • 34
  • 55
0

try this java code...i hope it is useful to you

LinearLayout layout=new LinearLayout(this);

LayoutParams layoutParam=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);  
        layout.setLayoutParams(new ScrollView.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

layout.setOrientation(LinearLayout.VERTICAL);
WebView detailsView=(WebView)findViewById(R.layout.jr_lb_view_preview_switcher);
layout.addView(detailsView, layoutParam);
detailsView.setVerticalScrollBarEnabled(true);
ScrollView scroll=new ScrollView(this);
scroll.addView(layout);
setContentView(scroll);
Christian Specht
  • 35,843
  • 15
  • 128
  • 182
Kandha
  • 3,659
  • 12
  • 35
  • 50
  • friend, for using Webview zooming it's not a problem we can use your code,my question is to set zoom control for ImageView. – MGSenthil Aug 21 '10 at 08:57