简体   繁体   中英

How to disable scrolling of an item in ListView android

I just want to protect my first item of list view from scrolling or to stick the first item at the top of my layout. I cannot use other layout for that.

Remember other elements must be scroll in that list view.

Can i do that and if yes tell me how ??(with array adapter or custom one or any other method to do that)

please help...

already visited Disable scrolling of a ListView contained within a ScrollView

and Disable scrolling in listview '

but it disable whole list view.

You can use a Header View:

mList.addHeaderView(yourFirstItemView);

Remember to inflate "yourFirstItemView", something like:

LayoutInflater inflater = getLayoutInflater();
yourFirstItemView = inflater.inflate(R.layout.item, parent);

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