Put a Linear Layout

I have created in my file .xml a linear layout
I want to create in this linear layout a linear layout which contains 3 linear layout with this latter contains a button and a text view below
I create a method but it does not display anything:
here's the method :

Sarra Sakka

Ranch Hand

Posts: 283

posted 5 years ago

I waant to put all this in Scroll View

Sarra Sakka

Ranch Hand

Posts: 283

posted 5 years ago

I want to show the image to explain better, but i don't know how can put it here

I suspect you are trying to do what a ListView already does. See the developers network article on ListViews. What I would suggest doing is create one Layout for just the inner most LinearLayout (I call this text_and_btton.xml):

Then you define the outer layout with a ListView:

Then you make an adapter that basically is a list of the text and images you want to put into the ListView. The adapter creates the 'inner most' of you layouts - the one with the button and text. Here is an example:

Then in the activity where you want to display the list, you build the layout with the list view, then get the ListView and set the adapter:

If you link this with your other posts, the ImageStuffAdapter is the correct place to do the database work to get the images and text you want to display.

When you do this, you could just as easily make the Buttons ImageViews. You do not need the Button's onClick event because you would use the ListView's onItemClick event to get which item (index) was clicked on.

Sample-ListView.png

output from above code

Steve

Sarra Sakka

Ranch Hand

Posts: 283

posted 5 years ago

Thanks a lot steve I want to put here the image that's i made with the photoshop to explain to you what i want exactly
how can i put it !!

Steve, I want to know if there is a method that allows you to erase the contents of a linear layout

Sarra Sakka

Ranch Hand

Posts: 283

posted 5 years ago

I need your help !!

Ulf Dittmer

Rancher

Posts: 42974

76

posted 5 years ago

Sarra Sakka wrote:I need your help !!

Possibly. But this is an all-volunteer forum, and demanding attention using exclamation marks isn't going to make people want to help you. Also, bumping posts repeatedly within the space of hours is considered bad behavior. PatienceIsAVirtue, as I've mentioned before. And you still don't seem to grasp that people sometimes sleep, and even when they're not, they might have better things to do than jump to your assistance.