I am facing two issue here.

1. If I create HorizontalScrollView and add custom view using
HorizontalScrollView.addview() the application did not crash but

my custom view is not display. It onDraw never gets called.

2. In other approach if I use XML and specify my custom view as child
of HorizontalScrollView then the application crashes.
    And I could not figure out how to provide agrument if to custom
view constructor when using XML approach.

Regards,
Yasir


---------- Forwarded message ----------
From: Dianne Hackborn <hack...@android.com>
Date: Wed, Apr 27, 2011 at 5:47 AM
Subject: Re: Custom view and horizontal scrolling
To: android-platf...@googlegroups.com


You need to make the view that is a child of the scroll view actually
larger in size than the scroll view so there is something to scroll.
Further questions on this would best be asked on android-developers or
StackOverflow.

On Tue, Apr 26, 2011 at 7:03 PM, yasir perwez <jugnoya...@gmail.com>
wrote:

    I have a custom view derived from View class. Where I am drawing a
graph using Canvas and I have implemented onDraw. This view is
horizontally bigger then screen.
    I want to make is scrollable horizontally. The custom take sevaral
argument it it constructor. I tried various option

    Like make layout xml and

    <?xml version="1.0" encoding="UTF-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <HorizontalScrollView android:id="@+id/scroll"
android:layout_width="fill_parent"
            android:layout_height="fill_parent"
android:fillViewport="true">

                <com.yasir.canvasTest.GraphView
android:layout_width="fill_parent"
                  android:layout_height="fill_parent"/>

    </HorizontalScrollView >

    </LinearLayout>

    then

    in onCreate of Activity

    setContentView(R.layout.horscroll);

    Question :- How will I specify argument to the contructor of my
custom view.

    I also tried creating HorizontalScrollView and adding custom view
using HorizontalScrollView.addview() the application did not crash but
    my custom view is not display. It onDraw never gets called.

    Please suggest me how to solve this issue.

    --
    Yasir Perwez

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to