Android - ScrollView, like four cards with cards + list

This is the Android equivalent of this iOS issue.

An attempt to create a view containing a MapView at about 20% of the screen (under the ActionBar ...), and the rest of the screen is a ScrollView, which when scrolling down overlaps on top of the MapView and hides it, in short, like an Android FourSquare application. Any ideas?

+7
android android-layout scrollview android-ui foursquare
source share
4 answers

I made an implementation based on AndroidSlidingUpPanel (many thanks to this project).

enter image description here

Details http://android.amberfog.com/?p=915 Source code with an example: https://github.com/dlukashev/AndroidSlidingUpPanel-foursquare-map-demo

+7
source share

LAST UPDATE

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <fragment android:id="@+id/map_fragment" android:name="com.myapp.MapFragment" android:layout_width="match_parent" android:layout_height="fill_parent" /> <fragment android:id="@id/list_fragment" android:name="com.myapp.ListFragment" android:layout_width="wrap_content" android:layout_height="fill_parent" /> 

Then I add an invisible title to the list, for example:

 @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. Hope this helps someone.

+4
source share

The simplest solution is to add a marker to the contents of the slider (the second parameter is SlidingUpPanel), and then remove the fading background. Everything is made from XML.

+1
source share

You can simply declare in your xml file a ScrollView , into which LinearLayout , which includes MapView is MapView :

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:fillViewport="true" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > ...... Your list and other stuff ....... </LinearLayout> </LinearLayout> </ScrollView> 

Then you can set the size for each element by specifying the layout_weight attribute

EDIT IvanDanDo, after our discussion, I found this link that can do what you want (not sure though, I have not tried it): Android: there is an arbitrary slide view under a different view, like a software keyboard

0
source share

All Articles