2015-01-01 3 views
1

내 앱에 정렬 문제가 있습니다. 세 부분을 만들고 싶습니다. 상단면은 메뉴이고 하단면은 화면 중간의 메뉴 및지도 섹션입니다. 당신이 그림에서 볼 수 있듯이, 나는,Android 테이블 행이 하단에 정렬

여기 당신이 수정 된 레이아웃을 시도 할 수 있습니다 내 레이아웃 XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    tools:context="com.ufukugur.app.MainActivity" 
    android:background="#000"> 
<!-- menu on the top --> 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:id="@+id/ustMenu"> 
     <TableRow 
      android:layout_marginLeft="0dp" 
      android:layout_marginTop="0dp" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:weightSum="7" > 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="50dp" 
        android:layout_height="50dp" 
        android:clickable="false" 
        android:gravity="left" 
        android:id="@+id/imgLogo"/> 
      </RelativeLayout> 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="36dp" 
        android:clickable="true" 
        android:onClick="menuHarita" 
        android:gravity="center_horizontal" 
        android:src="@drawable/menunokta" 
        android:id="@+id/imgMenuNokta"/> 
       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/imgMenuNokta" 
        android:textAppearance="?android:attr/textAppearanceSmall" 
        android:text="Sembol" 
        android:layout_alignParentBottom="true" 
        android:gravity="center_horizontal" 
        android:textColor="#fff" /> 
      </RelativeLayout> 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="36dp" 
        android:clickable="true" 
        android:onClick="menuHarita" 
        android:gravity="center_horizontal" 
        android:src="@drawable/menucizgi" 
        android:id="@+id/imgMenuCizgi"/> 
       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/imgMenuCizgi" 
        android:textAppearance="?android:attr/textAppearanceSmall" 
        android:text="Rota" 
        android:gravity="center_horizontal" 
        android:textColor="#fff" /> 
      </RelativeLayout> 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="36dp" 
        android:clickable="true" 
        android:onClick="menuHarita" 
        android:gravity="center_horizontal" 
        android:src="@drawable/menubolge" 
        android:id="@+id/imgMenuBolge"/> 
       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/imgMenuBolge" 
        android:textAppearance="?android:attr/textAppearanceSmall" 
        android:text="Bölge" 
        android:gravity="center_horizontal" 
        android:textColor="#fff" /> 
      </RelativeLayout> 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="36dp" 
        android:clickable="true" 
        android:onClick="menuHarita" 
        android:gravity="center_horizontal" 
        android:src="@drawable/menunotam" 
        android:id="@+id/imgMenuNotam"/> 
       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/imgMenuNotam" 
        android:textAppearance="?android:attr/textAppearanceSmall" 
        android:text="Notam" 
        android:gravity="center_horizontal" 
        android:textColor="#fff" /> 
      </RelativeLayout> 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="36dp" 
        android:clickable="true" 
        android:onClick="menuHarita" 
        android:gravity="center_horizontal" 
        android:src="@drawable/menufir" 
        android:id="@+id/imgMenuFir"/> 
       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/imgMenuFir" 
        android:textAppearance="?android:attr/textAppearanceSmall" 
        android:text="FIR" 
        android:gravity="center_horizontal" 
        android:textColor="#fff" /> 
      </RelativeLayout> 

      <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="36dp" 
        android:clickable="true" 
        android:onClick="menuHarita" 
        android:gravity="center_horizontal" 
        android:src="@drawable/menutrafik" 
        android:id="@+id/imgMenuTrafik"/> 
       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/imgMenuTrafik" 
        android:textAppearance="?android:attr/textAppearanceSmall" 
        android:text="Trafik" 
        android:gravity="center_horizontal" 
        android:textColor="#fff" /> 
      </RelativeLayout> 
     </TableRow> 
    </RelativeLayout> 

<!-- map and other things middle of the screen --> 
    <fragment xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/mapView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_marginTop="60dp" 
     android:layout_marginBottom="60dp" 
     android:name="com.google.android.gms.maps.MapFragment" 
     android:layout_alignParentBottom="true" /> 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="GPS bağlantısı sağlanıyor..." 
     android:id="@+id/textKonum" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:textColor="#ff0" 
     android:background="@color/black_overlay"/> 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="" 
     android:id="@+id/textYakin" 
     android:layout_alignParentBottom="true" 
     android:gravity="center_horizontal" 
     android:background="@color/black_overlay"/> 

    <ImageView 
     android:layout_width="40dp" 
     android:layout_height="40dp" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="15dp" 
     android:layout_marginTop="50dp" 
     android:clickable="true" 
     android:onClick="notamClicked" 
     android:src="@drawable/unlems" 
     android:id="@+id/imgNotam"/> 

    <ImageView 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="10dp" 
     android:layout_marginBottom="40dp" 
     android:clickable="false" 
     android:id="@+id/imageGSM"/> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/hats_basla" 
     android:clickable="true" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="5dp" 
     android:layout_marginTop="70dp" 
     android:id="@+id/imbKayit" /> 

<!-- bottom menu --> 
    <TableRow 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:weightSum="6" > 

     <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:onClick="menuHarita" 
       android:gravity="center_horizontal" 
       android:src="@drawable/menuharita" 
       android:id="@+id/imgMenuHarita"/> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/imgMenuHarita" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Harita" 
       android:layout_alignParentBottom="true" 
       android:gravity="center_horizontal" 
       android:textColor="#fff" /> 
     </RelativeLayout> 

     <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:onClick="menuHarita" 
       android:gravity="center_horizontal" 
       android:src="@drawable/menuguncel" 
       android:id="@+id/imgMenuGuncel"/> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/imgMenuGuncel" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Güncelle" 
       android:gravity="center_horizontal" 
       android:textColor="#fff" /> 
     </RelativeLayout> 

     <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:onClick="menuHarita" 
       android:gravity="center_horizontal" 
       android:src="@drawable/menubilgi" 
       android:id="@+id/imgMenuBilgi"/> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/imgMenuBilgi" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="HATS" 
       android:gravity="center_horizontal" 
       android:textColor="#fff" /> 
     </RelativeLayout> 

     <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:onClick="menuHarita" 
       android:gravity="center_horizontal" 
       android:src="@drawable/menuayarlar" 
       android:id="@+id/imgMenuAyarlar"/> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/imgMenuAyarlar" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Ayarlar" 
       android:gravity="center_horizontal" 
       android:textColor="#fff" /> 
     </RelativeLayout> 

     <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:onClick="menuHarita" 
       android:gravity="center_horizontal" 
       android:src="@drawable/menuara" 
       android:id="@+id/imgMenuAra"/> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/imgMenuAra" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Ara" 
       android:gravity="center_horizontal" 
       android:textColor="#fff" /> 
     </RelativeLayout> 

     <RelativeLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" > 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:onClick="menuHarita" 
       android:gravity="center_horizontal" 
       android:src="@drawable/menuradar" 
       android:id="@+id/imgMenuRadar"/> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/imgMenuRadar" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Meteo" 
       android:gravity="center_horizontal" 
       android:textColor="#fff" /> 
     </RelativeLayout> 
    </TableRow> 
</RelativeLayout> 

enter image description here

+0

테이블 행의 가운데에 와야하는 모든 다른 것들을 삽입하십시오. – Lal

답변

0

인 화면의 하단에 두 번째 메뉴를 정렬 할 수 없습니다 당신이 만든 것과는 완전히 다른 것이지만 당신이 원하는 것과 같은 결과를 가져옵니다.

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <!-- TOP SIDE MENU AND OTHER VIEWS --> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:contentDescription="@null" 
       android:gravity="center_horizontal" 
       android:onClick="menuHarita" 
       android:src="@drawable/ic_launcher" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="center_horizontal" 
       android:layout_gravity="center" 
       android:text="Img1" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:textColor="#000" /> 
     </LinearLayout> 


     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:contentDescription="@null" 
       android:gravity="center_horizontal" 
       android:onClick="menuHarita" 
       android:src="@drawable/ic_launcher" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:text="Img2" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:textColor="#000" /> 
     </LinearLayout> 

     // ADD YOUR REMAINING VIEWS HERE.......... 

    </LinearLayout> 


    <!-- MIDDLE LAYOUT MAP AND OTHER VIEW --> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"> 

     <fragment 
      android:id="@+id/mapView" 
      android:name="com.google.android.gms.maps.MapFragment" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" /> 

     <TextView 
      android:id="@+id/firstTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="GPS bağlantısı sağlanıyor..." 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentTop="true"/> 

     <TextView 
      android:id="@+id/firstTextView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="GPS bağlantısı sağlanıyor..." 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentBottom="true"/> 

     // ADD OTHER VIEWS HERE, BE CARE FULL THE PARENT LAYOUT IS RELATIVE LAYOUT 
      SO, ADD REMAINING THREE IMAGE VIEWS ACCORDINGLY...... 

    </RelativeLayout> 


    <!-- LOWER LAYOUT AND OTHER VIEWS VIEWING HORIZONTALLY --> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:contentDescription="@null" 
       android:gravity="center_horizontal" 
       android:onClick="menuHarita" 
       android:src="@drawable/ic_launcher" /> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="img1" 
       android:layout_gravity="center" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:textColor="#000" /> 
     </LinearLayout> 


     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="36dp" 
       android:clickable="true" 
       android:contentDescription="@null" 
       android:gravity="center_horizontal" 
       android:onClick="menuHarita" 
       android:src="@drawable/ic_launcher" /> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="img2" 
       android:layout_gravity="center" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:textColor="#000" /> 
     </LinearLayout> 

     // ADD OTHER VIEW HERE...... 

    </LinearLayout> 



</LinearLayout> 

참고 : 내 ID 및 기타 리소스를 사용자 자신의 것으로 교체해야합니다. 그냥이 레이아웃 가 귀하의 요구 사항에 따라 작동하는지 테스트하기 위해서 레이아웃을 복사하여 붙여 넣기 만하면됩니다. 에 따라 변경하십시오.

+0

알려 주시면 .../ –

+0

감사합니다. 약간의 수정 작업을했습니다. 위쪽 및 아래쪽 선형 레이아웃을 위해 tablerow를 추가했습니다. 전폭 화면을 사용해야하기 때문에. –

+0

환영합니다, Ufuk Ugur ... –