How to reference another GUI xml from within a GUI xml?

by Mariano Kamp » Sat, 27 Dec 2008 07:06:17 GMT


Sponsored Links
 Hi,

   let's consider this: You have a list view that shows all emails in  
your mailbox, but just their subject and from information. When you  
click on a list item to launch an activity that shows the full mail.  
The latter view also contains the same subject and from information,  
rendered the same way as in the list view (e.g. the subject is bold  
when the mail is unread).

   How to do that in a sane way? Let's define a mail_row.xml with two  
TextViews that represent the subject and from. So far so good, but how  
can I re-use this description in the email_full.xml to prevent  
duplication?

   Any ideas? If there isn't any sane way to do that, what would be  
the closest thing? A custom view?

Cheers,
Mariano

--~--~---------~--~----~------------~-------~--~----~



How to reference another GUI xml from within a GUI xml?

by Mark Murphy » Sat, 27 Dec 2008 07:25:44 GMT


 


I think <merge> or <include> will work, though I haven't experimented
with either as yet.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 1.9 Available!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


How to reference another GUI xml from within a GUI xml?

by Mariano Kamp » Sat, 27 Dec 2008 20:30:16 GMT


 Thank you Marc.

That was it. <include> worked fine.

Cheers,
Mariano






--~--~---------~--~----~------------~-------~--~----~



How to reference another GUI xml from within a GUI xml?

by Mariano Kamp » Sat, 27 Dec 2008 21:37:28 GMT


 Thank you Marc.

That was it. <include> worked fine.



On Sat, Dec 27, 2008 at 12:25 AM, Mark Murphy  





 >    let's consider this: You have a list view that shows all emails in
 > your mailbox, but just their subject and from information. When you
 > click on a list item to launch an activity that shows the full mail.
 > The latter view also contains the same subject and from information,
 > rendered the same way as in the list view (e.g. the subject is bold
 > when the mail is unread).
 >
 >    How to do that in a sane way? Let's define a mail_row.xml with two
 > TextViews that represent the subject and from. So far so good, but  
how
 > can I re-use this description in the email_full.xml to prevent
 > duplication?

I think <merge> or <include> will work, though I haven't experimented
with either as yet.

--
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 1.9 Available!




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. SoftKeyboard

Hello,
how do i disable the SoftKeyboard?
--~--~---------~--~----~------------~-------~--~----~

2. InstrumentationTestCase: Scrolling a listview to be able to click info icon associated with each item on the list

I am writing my android JUnit tests in InstrumentationTestCase class.
I would appreciate any help with the following scenarios as I tried
all the ways that I could think of, but with no luck.

I need to:

  1) Vefiry that the list actually scrolled (I mean verify that the
screen content changed when scrolled)
  2) Scroll a list view to be able to click on info button associated
with each item on the list when the list spans across screens.

Say there are 25 entries in the list and each screen can fit 10
entries. I need to iterate through the list and click the info button
associated with each item on the list and do some verifications. It
works fine for all the items on the first screen, but when the button
to be clicked is for the 11th and subsequent items in the list, it
fails, so I need to scroll to the next screen.

I was hoping that calling TouchUtils.dragQuarterScreenUp(this,
activity) 4 times would scroll one full screen, but it is not
scrolling exactly one screen.

I tried TouchUtils.dragViewToY by giving the offset by calculating:

int iScrollToY = childView .getHeight() * (listView.getChildCount() +
1); //assuming this is the Y coordinate of the 1st item on the next
screen

In the code above, listView is the ListView that displays all the
items and childView's value is listView.getChildAt(iLoopCounter):

int iScrollToY = childView.getHeight() * (listView.getChildCount() +
1); //assuming this is the Y coordinate of the 1st item on the next
screen

I tried several other values to pass to the y coordinate, they all
scroll but not by the value that I need. I see that TouchUtils has a
lot of drag methods, I am sure one of them can scroll by the number of
items in the list, but I am unable to figure out what to pass to the
pixel values for these drag/scroll methods.

when I try to use listView.scrollTo(x, y) with some values that I
thought would work, give the following error as the list view is not
created by my code but I am just testing the existing code:

android.view.ViewRoot$CalledFromWrongThreadException: Only the
original thread that created a view hierarchy can touch its views.

Can somebody please let me know the Y coordinate value that I need to
pass to one of these drag/scroll methods in TouchUtils to be able to
iterate through each item in the list( by either scrolling one item at
a time or one whole screen after visiting all the items on one screen)
or any other means to just scroll the ListView by passing as an
argument the number of list items to scroll.

Even if I can not see the list, that's ok as long as I can click the
info button corresponding to each item on the list by some how
scrolling the listview.

Thank you very much for reading this long post and thanks in advance
for your help.

-- 

3. Bad sound quality when recording/playing sounds...

4. Buffering problem while reading an h264 video (using HTTP protocol).

5. Yahoo Mail Setting for your Mobile

6. jsonarray as spinner source

7. New OMX component integration into Opencore