horizontal scrolling is only possible in webviews and mapviews
currently.

the home page currently works by stitching three views together inside
a custom view and running an onTouchEvent.

heres an example of a horisontal scrolling with 3 portrait screen
widths:

set this inside a new java file:
package com.example.android.skeletonapp;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.AbsoluteLayout;

public class yView extends AbsoluteLayout {

        public static int xcor, ycor, xcorclick, ycorclick;



        public yView(Context context, AttributeSet attrs) {
                super(context, attrs);



        }

        public yView(Context c){
                super(c);


                this.setMinimumWidth(960);
        }

        @Override public boolean onTouchEvent(MotionEvent event) {
                int action = event.getAction();
                int mCurX = (int)event.getX();


        if ( action == MotionEvent.ACTION_DOWN) {

                xcorclick = (int)event.getX();
        }


        if ( action == MotionEvent.ACTION_MOVE ) {



                int xcor = this.getLeft() - xcorclick + mCurX;

                if (xcor < -640)
                xcor = -640;

                if (xcor > 0)
                        xcor = 0;

                AbsoluteLayout.LayoutParams p = new 
AbsoluteLayout.LayoutParams(960,
AbsoluteLayout.LayoutParams.FILL_PARENT,xcor,0);
                this.setLayoutParams (p);

        }

        if ( action == MotionEvent.ACTION_UP ) {
                //this.setText("not moving");

        }
        return true;
}

        @Override public void draw(Canvas canvas) {
                // TODO Auto-generated method stub
                super.draw(canvas);

        }
}


and this as the main xml file:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="@+id/widget30"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent">

<com.example.android.skeletonapp.yView
android:id="@+id/tx1" android:background="@drawable/android"
android:layout_height="fill_parent" android:layout_width="960px">

</com.example.android.skeletonapp.yView>


</AbsoluteLayout>

'com.example.android.skeletonapp.yView'     make sure you change both
of these to match the location of the custom view file you created
with the java code above.

you can adjust the size of the view by setting all the 960's(in the
java and xml code) to any size you want(960's means the view is 960
pixels wide)

On Jan 16, 3:55 pm, e <[email protected]> wrote:
> is it possible horizontal scrolling on Relative Layout??
>
> On Jan 16, 11:47 pm, Romain Guy <[email protected]> wrote:
>
> > Hi,
>
> > ScrollView does not support horizontal scrolling at the moment.
>
> > On Fri, Jan 16, 2009 at 3:21 AM, RAM <[email protected]> wrote:
>
> > > Hi,
> > >    Currently i am working on a project using android. the problem i
> > > am facing in Table layout is that it is not scrolling
> > > horizontally.Since i am having lot of columns in table so horizontal
> > > scrolling is necessary. What i want is either a horizontal scrollbar
> > > should appear in table or my screen also scroll horizontally like its
> > > Home Screen.I am posting the XML which i am using for view:
>
> > > <?xml version="1.0" encoding="utf-8"?>
>
> > > <ScrollView xmlns:android="http://schemas.android.com/apk/res/android";
> > >    android:layout_width="wrap_content"
> > >    android:layout_height="wrap_content"
> > >    android:scrollbarSize="12dip">
>
> > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > > android"
> > >        android:orientation="vertical"
> > >        android:layout_width="wrap_content"
> > >        android:layout_height="wrap_content">>
>
> > > <TableLayout
> > > android:id="@+id/newleads_table"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:orientation="vertical"
>
> > > <TableRow
> > > android:id="@+id/widget38"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:orientation="horizontal"
> > > android:background="#FF0FFF"
>
> > > <TextView
> > > android:text="Name"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="Lead Category"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="Contact Number"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="Lead Id"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
>
> > > <TextView
> > > android:text="roll"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > </TableRow>
> > > <TableRow
> > > android:id="@+id/widget39"
> > > android:layout_height="wrap_content"
> > > android:orientation="horizontal"
> > > android:background="#0fffff"
>
> > > <TextView
> > > android:text="Eric Mayor"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="Recieved"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="9804352210"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="11082"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="11082"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > </TableRow>
> > > <TableRow
> > > android:id="@+id/widget39"
> > > android:layout_height="wrap_content"
> > > android:orientation="horizontal"
> > > android:background="#0fffff"
>
> > > <TextView
> > > android:text="Eric Mayor"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="Recieved"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="9804352210"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="11082"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="11082"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > </TableRow>
> > > <TableRow
> > > android:id="@+id/widget39"
> > > android:layout_height="wrap_content"
> > > android:orientation="horizontal"
> > > android:background="#0fffff"
>
> > > <TextView
> > > android:text="Eric Mayor"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="Recieved"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="9804352210"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="11082"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > <TextView
> > > android:text="11082"
> > > android:padding="5dip"
> > > android:textColor="#000000"
> > > />
> > > </TableRow>
> > > </TableLayout>
> > > </LinearLayout>
> > > </ScrollView>
>
> > > and in my jav class i am using:
>
> > > setContentView(R.layout.leadstable);
>
> > > If any one can tell me how to enable horizontal scrolling in Table
> > > Layout or How can we make our screen horizontally scrolling like
> > > androids Home Screen.
>
> > --
> > Romain Guy
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to