How can i scroll my view

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How can i scroll my view

Postby yinglcs » Wed Nov 19, 2008 7:30 am

I have my simple HelloWorld application for android:

Code: Select all

public class HelloView extends View {

   public HelloView(Context context) {
      super(context);
      // TODO Auto-generated constructor stub
   }

   
   @Override
   protected void onDraw(Canvas canvas) {
      

      super.onDraw(canvas);
      
      Paint p=new Paint();
      p.setColor(0xFF800000);
      p.setStyle(Paint.Style.STROKE);

      
      canvas.drawLine(10, 10, 40, 40, p);
   }
}

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
          HelloView hv = new HelloView(this);
         
         
          setContentView(hv);

    }
}



My question is how can I implement listen for key Event (say 'press 'j' and my view will scroll up by 10 pixels)?
yinglcs
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Nov 14, 2008 6:19 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google Feedfetcher and 5 guests