Created
December 8, 2015 12:22
-
-
Save Lingviston/1d97660f7a5888ca0f76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity implements SlidingUpPanelLayout.PanelSlideListener{ | |
private SupportMapFragment mMapFragment; | |
private SlidingUpPanelLayout mSlidingUpPanelLayout; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
mSlidingUpPanelLayout = (SlidingUpPanelLayout) findViewById(R.id.slidingUpLayout); | |
mSlidingUpPanelLayout.setPanelSlideListener(this); | |
mMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); | |
mMapFragment.getMapAsync(new OnMapReadyCallback() { | |
@Override | |
public void onMapReady(GoogleMap googleMap) { | |
LatLng latLng = new LatLng(53.9, 27.5666667); | |
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 17); | |
MarkerOptions options = new MarkerOptions().position(latLng); | |
googleMap.addMarker(options); | |
googleMap.moveCamera(cameraUpdate); | |
} | |
}); | |
} | |
@Override | |
public void onPanelSlide(View panel, final float slideOffset) { | |
final int panelHeight = findViewById(R.id.panel).getHeight(); | |
final int visiblePanelHeight = mSlidingUpPanelLayout.getPanelHeight(); | |
mMapFragment.getMapAsync(new OnMapReadyCallback() { | |
@Override | |
public void onMapReady(GoogleMap googleMap) { | |
CameraPosition cameraPosition = googleMap.getCameraPosition(); | |
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition); | |
googleMap.setPadding(0,0,0, (int) (visiblePanelHeight + (panelHeight - visiblePanelHeight) * slideOffset)); | |
googleMap.moveCamera(cameraUpdate); | |
} | |
}); | |
} | |
@Override | |
public void onPanelCollapsed(View panel) { | |
} | |
@Override | |
public void onPanelExpanded(View panel) { | |
} | |
@Override | |
public void onPanelAnchored(View panel) { | |
} | |
@Override | |
public void onPanelHidden(View panel) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<com.sothree.slidinguppanel.SlidingUpPanelLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/slidingUpLayout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="bottom" | |
app:umanoOverlay="true" | |
app:umanoPanelHeight="40dp" | |
app:umanoShadowHeight="0dp" | |
app:umanoFadeColor="@android:color/transparent"> | |
<fragment | |
android:id="@+id/map" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:name="com.google.android.gms.maps.SupportMapFragment" | |
tools:context=".MapsActivity"/> | |
<TextView | |
android:id="@+id/panel" | |
android:layout_width="match_parent" | |
android:layout_height="400dp" | |
android:text="Drag me" | |
android:background="@android:color/white" | |
android:gravity="center_horizontal|top"/> | |
</com.sothree.slidinguppanel.SlidingUpPanelLayout> |
I have done exactly what u said . I mean just changes in xml 's . Ahha.... mine is Hidden on start might be thats why . As i want it changed to collapsed on marker click only
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actually slidingUpPanel is collapsed on start. You defenitly do something wrong.