问题
I have a VideoView which is inside a Framelayout , and has few other elements like imageviews and below is a List View.I want to be able to scroll all the views using single scroll.
The video should get scrolled along with the list view as a single entity !
Have a look at TED Conferences app, here: https://play.google.com/store/apps/details?id=com.ted.android&hl=en
I want to do something similar to that , any ideas & help will be very appreciated. Thank You guys!
回答1:
You can use 3 layouts:
- Buttons and VideoView - header
- ListView - main layout
- another content if needed - footer
ListView lv = (ListView) findViewById(R.id.listView);
View header = getLayoutInflater().inflate(R.layout.header_layout, null);
View footer = getLayoutInflater().inflate(R.layout.foorer_layout, null);
lv.addHeaderView(headerComment);
lv.addFooterView(footerComment);
For tabs functionality you can use TabHost.
回答2:
The TED app I have probably uses a header on their ListView for the "first" item. They might also be using multiple row layouts in the ListView, but if you only want the one row at the top to be different using a header view makes more sense. Check out ListView#addHeaderView()
(Also I wouldn't expect people to download apps to help you with your question. Grab a few screenshots next time.)
来源:https://stackoverflow.com/questions/13241294/how-to-make-a-lot-views-scroll-together-as-a-single-element-in-android