The difference between removeViewInLayout() and removeAllViews()

by xhy » Mon, 24 May 2010 11:00:36 GMT


Sponsored Links
 hi all ,i inflate a xml nd add it to a mapview .But i want to remove it
when  i click a button.I must click the button two times sothat i can remove
it when i  use the  removeViewInLayout()  method ,but if
using removeAllViews() will do . Why?Thank you !


the code is:
add the view to mapview:

                 ll = (LinearLayout)mInflater.inflate(R.layout.bubble,null
);
         LayoutParams lp = new
LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT, p, 0, -70,
 LayoutParams.MODE_MAP | LayoutParams.CENTER);

         map.addView(ll,lp);


remove it:
            map.removeAllViews();     ////////ok
            map.removeViewInLayout(ll); ///////must click two times

-- 
xhy

--



Other Threads

1. Space greedy ListView

I'm building a simple view programmatically.  Boiled down,
it's something like this:

        LinearLayout l = new LinearLayout(this);
        l.setOrientation(LinearLayout.VERTICAL);

        TextView t = new TextView(this);
        l.addView(t);

        ListView lv = new ListView(this);
        l.addView(lv);

        Button b = new Button();
        l.addView(b);

        setContentView(l);

This works fine.  Then I start adding items to
the ListView as certain actions happen in the
program.  When I get enough items, the button
gets pushed off of the bottom of the screen
and disappears.  How can I avoid this?

I'm also not sure how to anchor the button to
the bottom in the beginning when the ListView
has only a few items.  As it is, it hugs the
ListView and moves down as the list grows.

Thanks!

Tobiah

--

2. best way to storage data on android

Hi,

I'm a newbie on Android dev. But I want to know what the best way to storage 
data on android....file or SQLite because...i want to save a list of 
restaurants with street address,  Lat and long, and pictures...and update it 
over internet....

Anybody has any reference to send me !?

Best regards
Igor Nesralla Ribeiro

-- 

3. RunTime Error

4. codec for .au

5. Problems accessing system properties in java.net.AddressCache

6. drawLine problem with Paint.StrokeWidth = 1

7. Amazon AppStore Release