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