2017-03-17 31 views
3

我試圖重新從谷歌車次layotu,最佳做法將佈局分區切換到Android中的切片?

enter image description here

,我不能調整側磚此起彼伏,仍然保持了屏幕的分成兩半。

這是香港專業教育學院得到了迄今爲​​止

enter image description here

我的佈局xml文件

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_slides__screen" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="msn.apps.textswipehd.Slides_Screen.Slides_Screen" 
    tools:showIn="@layout/activity_slides__screen"> 

    <RelativeLayout 
     android:id="@+id/upperLayout" 
     android:layout_width="match_parent" 
     android:layout_height="200dp"> 

     <ImageView 
      android:id="@+id/mainImage" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/slides_bg" /> 

     <TextView 
      android:id="@+id/mainHeadlineText" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="15dp" 
      android:layout_marginTop="10dp" 
      android:shadowColor="@color/text_shadow" 
      android:shadowDx="1" 
      android:shadowDy="1" 
      android:shadowRadius="2" 
      android:text="projectName" 
      android:textColor="@color/projectWhite" 
      android:textSize="20dp" 
      android:textStyle="bold" /> 

     <Button 
      android:id="@+id/editButton" 
      android:layout_width="30dp" 
      android:layout_height="30dp" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="20dp" 
      android:layout_marginTop="10dp" 
      android:background="@drawable/ic_create_white_24dp" /> 

    </RelativeLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/upperLayout"> 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/linearUpper" 
      android:orientation="horizontal"> 

      <RelativeLayout 
       android:layout_width="0dp" 
       android:layout_height="180dp" 
       android:layout_weight="1" 
       android:background="@color/colorPrimaryDark"> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/upperRightLayout" 
       android:layout_width="0dp" 
       android:layout_height="100dp" 
       android:layout_weight="1" 
       android:background="@color/colorPrimary"> 

      </RelativeLayout> 

     </LinearLayout> 



     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/linearUpper" 
      android:orientation="horizontal"> 

      <RelativeLayout 
       android:layout_width="0dp" 
       android:layout_height="180dp" 
       android:layout_weight="1" 
       android:background="@color/colorPrimaryDark"> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/upperRightLayout2" 
       android:layout_width="0dp" 
       android:layout_height="100dp" 
       android:layout_weight="1" 
       android:background="@color/colorPrimary"> 

      </RelativeLayout> 

     </LinearLayout> 

    </RelativeLayout> 

</RelativeLayout> 

我怎樣才能調整側磚喜歡旅行應用程序的佈局? 你有更好的做法來做瓷磚佈局嗎?

+4

使用與staggeredlayout管理器的回收站視圖 –

+0

首席Madog,您的內容是靜態的或從服務器更改。兩者最後都會使用RecyclerView,但幾乎沒有變化 –

回答

0

你可以這樣做通過dimens.xml這是values.xml。您可以根據需要從佈局中指定水平和垂直邊距。也請通過GridView。希望能幫助到你 !