How to make a GraphicsView scrollable

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

How to make a GraphicsView scrollable

Postby morph » Mon Mar 16, 2009 10:12 am

Hi,

is it possible to use a ScrollView with a GraphicsView? I tried something like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  GraphicsView gv = new GraphicsView(this);
  2.  
  3. ScrollView sv = new ScrollView(this);
  4.  
  5. sv.addView(gv);
  6.  
  7. setContentView(sv);
  8.  
  9.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


but the screen remains blank. The class GraphicsView is implemented and the onDraw Method draws somenthing on the screen (and some graphics out of Screen i wanted to scroll to). SetContentView(gv) works great. What is wrong, can i use ScrollView with GraphicsView? Or should i use an other View (SurfaceView)?

Thx for any comments
morph
Freshman
Freshman
 
Posts: 4
Joined: Mon Mar 16, 2009 9:53 am

Top

Postby MrSnowflake » Mon Mar 16, 2009 12:45 pm

Did you try it in a 'normal' LinearLayout?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby morph » Mon Mar 16, 2009 1:19 pm

Hi,

thanks for your answer. Do you mean

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. LinearLayout la = new LinearLayout(this);
  3.  
  4. GraphicsView gv = new GraphicsView(this);
  5.  
  6. la.setVerticalScrollBarEnabled(true);
  7.  
  8. la.addView(gv);
  9.  
  10. setContentView(la);
  11.  
  12.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


This displays the graphic, but no Scrollbar on the right. Am i missing something?
morph
Freshman
Freshman
 
Posts: 4
Joined: Mon Mar 16, 2009 9:53 am

Postby morph » Mon Mar 16, 2009 1:50 pm

sorry, i didn't realized that linearLayout has a method like dispathDraw that i can overwrite. I try this out, thank you
morph
Freshman
Freshman
 
Posts: 4
Joined: Mon Mar 16, 2009 9:53 am

Postby morph » Mon Mar 16, 2009 2:02 pm

mh, same procedure, graphic is displayed, but no scrollbars. i tried to call the computeScroll() method after drawing, but still no effect. any ideas?

thx
morph
Freshman
Freshman
 
Posts: 4
Joined: Mon Mar 16, 2009 9:53 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests