dynamically add view to view flipper

by Andy Droid » Sat, 05 Sep 2009 09:38:57 GMT


Sponsored Links
 Trying to dynamically add a view to a ViewFlipper.  I want to extend
ViewFlipper so I can modify it.  Here is the code.  The child does get
added, but it doesn't show up.  Any ideas?  thanks


public class DCMFlipper extends ViewFlipper {

        DCMFlipper(Context context){
                super(context);
                TextView tv = new TextView(context);
                tv.setLayoutParams(new ViewGroup.LayoutParams
(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.FILL_PARENT));
                tv.setTextColor(150);
                tv.setText("THIS IS A TEST");
                this.addView(tv);
        }
}
--~--~---------~--~----~------------~-------~--~----~



dynamically add view to view flipper

by nimph » Sat, 05 Sep 2009 09:50:52 GMT


 Something like this should do it:

     setDisplayedChild(getDisplayedChild() + 1);

//



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


Sponsored Links


Other Threads

1. Click on Status bar notification switch to task in current state?



The "task switcher" you refer to is not actually a task switcher. It
just shows you a list of recently used apps, which may or may not be
currently running.
You may be able to do what you want by having the notification start a
'dummy' activity, which in turn brings your real activity to the
front.

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

2. Assets not copying to device/emulator (Eclipse)

I have a test project with a WebView that displays a html page
(demo.html) stored in the assets folder.  I've stored images and
databases in the assets folder before without any problem, but for
some reason now that assets aren't being seen.  The code I'm using is
as follows;

WebView webStep = (WebView)findViewById(R.id.webview);
webStep.loadUrl("file:////data//data//com.test//assets//demo.html");

When I run this the UI displays the WebView displays page not found.
What am I doing wrong?

Thanks

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

3. AsyncTask - wait until the task has finished

4. ListActivity style question

5. How to change text in a XML-defined text view

6. Problem while compiling the cupcake Android release for the HTC G1 dev edition

7. AsyncTask - wait until the task has finished