T
T
The_Prodigy2014-07-04 12:15:12
Java
The_Prodigy, 2014-07-04 12:15:12

How to add View components to ScrollView?

There is a screen with .xml markup.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/www2"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:id="@+id/www1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

        </LinearLayout>
    </ScrollView>

</LinearLayout>

I work with 2D graphics, I need to add several Views to this screen so that the ScrollView works. The class itself:
public class Ticket extends View
{

  public Ticket(Context context)
  {
    super(context);
  }

  @Override
    public void onDraw(Canvas canvas)
  {
    Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
    canvas.drawBitmap(image, 40, 80, null);
    }
}

How to implement it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question