2015-02-03 5 views
1

전체 화면 모드로 전환 할 때 Gridview를 맨 아래로 설정하려고했습니다. 전체 화면으로 전환 할 때마다 항상 맨 위에 있기 때문에 뭔가 잘못하고 있어야합니다.전체 화면으로 전환 할 때 Gridview가 제대로 작동하지 않습니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/black" 
    android:orientation="vertical" > 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewPager" 
     android:layout_width="match_parent" 
     android:layout_height="820px" 
     android:layout_alignBottom="@+id/imgView" /> 

    <GridView 
     android:id="@+id/gridView" 
     android:layout_width="wrap_content" 
     android:layout_height="106px" 
     android:layout_above="@+id/relativeLayout2" 
     android:layout_alignParentLeft="true" 
     android:stretchMode="columnWidth"   
     android:gravity="center" 
     android:padding="2dp" 
     android:numColumns="auto_fit"   
     android:columnWidth="66dp"   
     android:horizontalSpacing="6dp"   
     android:verticalSpacing="6dp" 
     android:drawSelectorOnTop="true" /> 

    <ImageView 
     android:id="@+id/imgView" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_above="@+id/gridView" 
     android:layout_alignParentLeft="true" 
     android:adjustViewBounds="true" 
     android:background="@color/black" 
     android:contentDescription="@string/app_name" /> 


    <RelativeLayout 
     android:id="@+id/relativeLayout2" 
     android:layout_width="fill_parent" 
     android:layout_height="150dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:background="@drawable/metal_frame" > 

     <ImageButton 
      android:id="@+id/button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="2dp" /> 

     <TextView 
      android:id="@+id/textview" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="15dp" 
      android:text="text" 
      android:textSize="14sp" 
      android:textStyle="bold" /> 

    </RelativeLayout> 

</RelativeLayout> 

누군가가 방법의 GridView가 전체 화면 모드의 하단에 표시 할 수 있도록하는 나에게 보여 주시겠습니까 : 여기

는 XML인가?

감사합니다 너무 많은

enter image description here

답변

0

과 같이 relativeLayout2 위의 imgView 다음 , 그리고 가되도록의 GridView를 이야기 해보세요 :

<android.support.v4.view.ViewPager 
    android:id="@+id/viewPager" 
    android:layout_width="match_parent" 
    android:layout_height="820px" 
    android:layout_alignBottom="@+id/imgView" /> 

<GridView 
    android:id="@+id/gridView" 
    android:layout_width="wrap_content" 
    android:layout_height="106px" 
    android:layout_below="@+id/imgView" 
    android:layout_alignParentLeft="true" 
    android:stretchMode="columnWidth"   
    android:gravity="center" 
    android:padding="2dp" 
    android:numColumns="auto_fit"   
    android:columnWidth="66dp"   
    android:horizontalSpacing="6dp"   
    android:verticalSpacing="6dp" 
    android:drawSelectorOnTop="true" /> 

<ImageView 
    android:id="@+id/imgView" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_above="@+id/gridView" 
    android:layout_alignParentLeft="true" 
    android:adjustViewBounds="true" 
    android:background="@color/black" 
    android:contentDescription="@string/app_name" /> 


<RelativeLayout 
    android:id="@+id/relativeLayout2" 
    android:layout_width="fill_parent" 
    android:layout_height="150dp" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:background="@drawable/metal_frame" > 

    <ImageButton 
     android:id="@+id/button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="2dp" /> 

    <TextView 
     android:id="@+id/textview" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="15dp" 
     android:text="text" 
     android:textSize="14sp" 
     android:textStyle="bold" /> 

</RelativeLayout> 

+0

답변 해 주셔서 감사합니다. 이제 gridView가 화면의 절반 아래에 있습니다. 어떻게하면 바닥까지 갈 수 있습니까? 이 코드에서 시도했습니다 \t \t gridView.setLayoutDirection (RelativeLayout.ALIGN_BOTTOM);하지만 아무 것도하지 않습니다. 고마워. –

관련 문제