简体   繁体   中英

linear layout inside listview linear layout

I have a list view , each item of my list view having again list of dynamic data to display, when I am trying to inflate a linear layout inside listview linear layout inflating only the last item.

How can I do this? Can anyone help me?

for (RoomCategory room : hotelInfo.roomCategory) {

            final View roomView = inflater.inflate(R.layout.item_hotel_room, null);
            final TextView type = (TextView) roomView.findViewById(R.id.item_hotel_type);
            final TextView desc = (TextView) roomView.findViewById(R.id.item_hotel_desc);
            final TextView price = (TextView) roomView.findViewById(R.id.item_hotel_price);

            for (RoomType roomType : room.roomType) {


                type.setText(room.name + " - "+ roomType.type);


                for (Rate rates : roomType.rates) {

                    for (RoomSeq roomSeq : rates.roomRate.roomSeqs) {

                        price.setText(currency + " -" + TravflexUtil.friendlyPrice(roomSeq.roomPrice));

                    }

                }
            }

             views.rooms.addView(roomView);
        }

     }

Please refer this code

我不太明白您的问题,请尝试查看本指南 练习:带有自定义布局的 ListActivity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM