开发者

Dynamically create and remove Linear Layouts and List Views

So here's the deal.

My app's layout is set up with a View Flipper. The View Flipper contains seve开发者_开发技巧n Linear Layout children (views). Each Linear layout then contains a List View. Each linear layout represents a different category in my app.

And here is my dilemma.

Currently my layout is pretty static and bland, so I want to be able to give users the ability select any number of the available categories. This will mean I will have to be able to dynamically create and remove Linear Layouts, each with its own List View. There's also the question of creating and removing Array Adapters for my List Views.

Any suggestions?


How can I disable all views inside the layout?

With this link you can find three approaches : disabling, removing and hiding.

Then if you want to add something after this, you can do it in your java code :

ViewFlipper mVF = (ViewFlipper) findViewById(R.id.my_ViewFlipper); //retrieve your ViewFlipper if it is in an xml file.
LinearLayout lila1 = new LinearLayout(this);
ListView livi1 = new ListView(this);
lila1.addView(livi1);
mVF.addView(lila1);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜