Android - ScrollView like foursquare with maps + list

前端 未结 4 2094
轻奢々
轻奢々 2021-01-31 06:52

This is the Android equivalent of this iOS question.

Trying to create a view that contains a MapView at about 20% of the screen (under an ActionBar...) and the rest of t

4条回答
  •  余生分开走
    2021-01-31 07:19

    LAST UPDATE

    
    
    
    
    
    

    Then I add an invisible header to the list like so:

    @Override
    public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
    
        View view = inflater.inflate(R.layout.listview, container, false);
        SwipeListView listView = (SwipeListView) view.findViewById(R.id.venue_list);
    
        // An invisible view added as a header to the list and clicking it leads to the mapfragment
        TextView invisibleView = new TextView(inflater.getContext());
        invisibleView.setBackgroundColor(Color.TRANSPARENT);
        invisibleView.setHeight(300);
        invisibleView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.moveToMapFragment();
                                                                            }
        });
        listView.addHeaderView(invisibleView);
    

    This is hardly ideal, but it works. I hope it helps someone..

提交回复
热议问题