2011-08-08 116 views
0

我想創建一個自左向右用這個例子滑動抽屜在MapView類:左向右滑動抽屜在MapView的.......

http://www.anddev.org/viewtopic.php?p=16622

但它分割屏幕分爲兩部分,上部MapView和第二部分顯示滑動抽屜。

請建議我如何創建一個側面滑動抽屜在地圖..

我爲result.xml樣子如下:

<?xml version="1.0" encoding="utf-8"?> 

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:panel="http://schemas.android.com/apk/res/com.app.SL" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#767c9b" 
     > 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 

    <com.google.android.maps.MapView 
    android:id="@+id/myGMap" android:layout_width="fill_parent" 
    android:enabled="true" android:clickable="true" 
    android:apiKey="0cgwXB2sO7JjQpz_Ho3KFg60hJSL3GjWWAC4yQA" 
    android:layout_height="343dp" android:layout_weight="1.26" /> 


    <com.app.SL.Panel 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:id="@+id/leftPanel2" 
     android:layout_weight="1" 
     android:layout_gravity="left" 
     panel:position="left" 
     panel:openedHandle="@drawable/left_switcher_expanded_background" 
     panel:closedHandle="@drawable/left_switcher_collapsed_background" 
    > 
     <Button 
      android:id="@id/panelHandle" 
      android:layout_width="33dip" 
      android:layout_height="fill_parent" 
     /> 
     <TextView 
      android:id="@id/panelContent" 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:gravity="center" 
      android:padding="4dip" 
      android:text="This is\nmy second\nleft Panel" 
      android:textSize="16dip" 
      android:textColor="#eee" 
      android:textStyle="bold" 
      android:background="#115544" 
     /> 
     </com.app.SL.Panel> 
     </LinearLayout> 


     </FrameLayout> 
+0

可以繪製從[這裏]滑動抽屜(http://blog.sptechnolab.com/2011/02/10/android/android-sliding-drawer/)你可以看看[這裏](http://blog.pocketjourney.com/2008/03/15/tutorial-1-transparent-panel-linear-layout-on-mapview-google-map/)以獲取更多信息可以嘗試[這](http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html) – Hanry

+0

謝謝hanry ..但我想實現滑動抽屜拖動打開功能....所有三個鏈接不是那個..首先是看起來像滑動抽屜,但是..所有關於改變可見性... –

+0

@jiya第一件事改變你的佈局爲相對在哪個地圖放置。 LinearLayout的問題是您忘記放置重量。將android:layout_weight =「1」賦予mapview和android:layout_weight =「0」面板佈局。 – Hanry

回答

0

多德嘗試我的代碼,你將不得不從你的滑動抽屜在此之前,從左至右

<SlidingDrawer 
    android:id="@+id/drawer" 
    android:layout_width="300dp" 
    android:layout_height="match_parent" 
    android:content="@+id/content" 
    android:handle="@+id/handle" 
    android:orientation="horizontal" 
    android:rotation="180" > 

    <Button 
     android:id="@+id/handle" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" /> 

    <LinearLayout 
     android:id="@+id/content" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 
    </LinearLayout> 
</SlidingDrawer> 

</LinearLayout>