как показать кнопку на карте вид андроида - PullRequest
0 голосов
/ 07 мая 2011

в моем приложении я использую флиппер вида.С одной стороны, я разместил текст и изменил вид текста.В другой части сальто у меня есть вид карты.

Для переключения между этими двумя видами я использую концепцию смахивания.Я могу провести от текстового представления к представлению карты.Но чтобы вернуться на текстовую страницу из вида, я решил разместить кнопку в представлении карты, но кнопка не видна.

Ниже приведена схема расположения флиппера

<ViewFlipper android:background="#000000"  android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/viewFlipper1">
           <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
                         android:layout_height="wrap_content" android:layout_marginTop="25dip"
                         android:layout_marginBottom="10dip">
                  <TextView android:id="@+id/distance" android:text="0.0" android:textColor="#ffffff"
                            android:layout_width="80dip" android:layout_height="wrap_content"
                            android:gravity="center_vertical|right" android:layout_marginLeft="18dip"
                            android:textSize="20dip">
                  </TextView>     

                  <Spinner android:id="@+id/unitspinner" android:layout_width="fill_parent"
                           android:layout_height="wrap_content" android:drawSelectorOnTop="true"
                           android:prompt="@string/unit_prompt"/>           
            </LinearLayout>

            <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<com.google.android.maps.MapView android:id="@+id/mapView"
                                 android:layout_width="wrap_content"
                                 android:layout_height="match_parent"
                                 android:enabled="true"
                                 android:clickable="true"                                 android:apiKey="0XXXXXXXXXXXXXXXXXXXX">
 <Button android:id="@+id/widget306" android:layout_width="wrap_content" android:layout_height="wrap_content"
                   android:text="Back">
           </Button>
               </com.google.android.maps.MapView>

                  <LinearLayout android:id="@+id/zoom" android:layout_width="wrap_content" android:layout_height="wrap_content" 
                                android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"> 
                  </LinearLayout> 

            </LinearLayout>
        </ViewFlipper>

, как сделать так, чтобы кнопка была видимой.Пожалуйста, помогите мне ....

1 Ответ

1 голос
/ 09 мая 2011

Кнопки видны только в относительной раскладке. XML-файл должен быть следующим

?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/map_main"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent" >


<com.google.android.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="0y6Hyjz6Kxo-NOV_9KHYF7-ECYeGt99xeyVU3IQ"/>

<Button 
    android:id="@+id/select_3" 
    android:layout_marginTop="13dp"
    android:layout_height = "wrap_content"
    android:layout_width  = "wrap_content"
    android:onClick="selfSelectCenterLocation">
</Button>
</RelativeLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...