1. Check out our app, Forums for Android! Download and leave feedback here!

Draw on inflated view

Discussion in 'Application Development' started by Kerric, Oct 21, 2010.

  1. Kerric

    Kerric New Member
    Thread Starter
    5

    Oct 21, 2010
    1
    0
    5
    Hey all,

    I am working on something that requries a little different approach than usuall --at least different than what I was able to find on the net.

    I have a class which extends View and which has its own.xml file, I don't have the exact code with me but it's something like this
    viewxml.xml
    Code (Text):
    1. tablelayout
    2.    tablerow
    3.       <view id="view1" />
    the class itself, is something like the following:
    namespace com.example.helloandroid
    Code (Text):
    1.  
    2. class viewClass extends View
    3. {
    4.     public viewClass()
    5.     {
    6.         LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    7.         View theview = li.inflate(R.layout.viewxml, this);
    8.      }
    9.  
    10.     public void onDraw(Canvas canvas)
    11.     {
    12.        
    13.     }
    14. }
    15.  
    all in the above goes well, however, I would like to draw on the view element defined in the xml file as view1, the view that I get reference to when using inflate method represent the entire viewxml.xml file.

    is there a way i can do that ?? maybe by simply calling findViewById ??

    any help would be appreciated.
    Thank you
     

    Advertisement

Share This Page

Loading...