简体   繁体   中英

scroll two list view in the same LinearLayout

I have two listViews in the same LinearLayout. Each listView looks like this:

<ListView
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:id="@+id/listViewReceived"
    android:layout_weight="1"
    >
</ListView>    
<ListView ><!--same as above-->

The issue is that the two listViews have a scrollbar but I want show all the items without a scrollbar.

if I make scrolling in anyone the listviews the movement is generated internally. but I want show scrollbar in entire the screen. how the green bar. https://drive.google.com/file/d/0B_Z2NZi-dbUMc3FCOTQ1UDNWRnM/view

issue is that the two listView have your scrollbar but I want show all the items without scrollbar.

Add this to all of the listview

android:scrollbars="none"

android:scrollbars=none will define which scrollbars to display or show any at all. This won't disable scrolling as such (you'll be able to scroll in the appropriate direction) but just hide the scrollbars from the user interface. Try Following Code

listView.setOnTouchListener(new OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            return true; // Indicates that this has been handled by you and will not be forwarded further.
        }
        return false;
    }
});

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