2014-02-18 2 views
0

안녕하세요, 내 응용 프로그램에 Google지도가 있습니다. 기본적으로 화면의 오른쪽 상단에있는 조각을 이동하여 다른 것들을 추가 할 수 있습니다. 누구든지 제발 어디서부터 시작하라고 조언 할 수 있습니까? 내 레이아웃은 다음과 같습니다.조직 구성 조각 상대 레이아웃

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
android:layout_width="fill_parent"  
android:layout_height="fill_parent" >  
<fragment   
    android:id="@+id/map"   
    android:name="com.google.android.gms.maps.MapFragment"   
    android:layout_width="wrap_content"   
    android:layout_height="wrap_content"/> 


</RelativeLayout> 
+0

먼저를 기준으로 다른 뷰를 추가 그보기들은 당신이 원하는 곳에서 조각을 oraganize. 또는 tfragment를 넣고 원하는 곳에 뷰를 구성하십시오. – Raghunandan

답변

1

레이아웃에 다른보기를 추가하십시오. 조각을 다른보기와 관련하여 배치 할 수 있습니다.

당신은 당신의 요구에

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
android:layout_width="fill_parent"  
android:layout_height="fill_parent" > 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="50dp" 
     android:layout_marginTop="57dp" 
     android:text="Button" /> 

    <fragment 
    android:id="@+id/map" 
    android:layout_toRightOf="@id/button1" 
    android:name="com.google.android.gms.maps.MapFragment" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" /> 

</RelativeLayout> 

에 맞게 조각의 높이와 폭을 조정할 수 있습니다 스냅

enter image description here

또는

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
android:layout_width="fill_parent"  
android:layout_height="fill_parent" > 

    <fragment 
    android:id="@+id/map" 
    android:layout_alignParentRight="true" 
    android:name="com.google.android.gms.maps.MapFragment" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/map" 
     android:layout_marginRight="17dp" 
     android:layout_marginTop="149dp" 
     android:layout_toLeftOf="@+id/map" 
     android:text="Button" /> 

</RelativeLayout> 
+0

감사합니다. –