2015-09-06 120 views

回答

3

您可以使用

機器人:layout_weight =「1」

爲您的每個項目,將解決你的問題,並安排在屏幕上使用相同的空間項目

+0

感謝它的工作。 – hybrid

2

試試這個:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <ImageView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#ff5678" /> 


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

    <ImageView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#ff5678" /> 

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

    <ImageView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#ff5678" /> 

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

    <ImageView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#ff5678" /> 

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

    <ImageView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#ff5678" /> 
</LinearLayout> 

beetwen each ImageView加空View使用參數:android:layout_width="0dp" android:layout_weight="1"

+0

感謝它的工作 – hybrid

1

您可以使用JustifyLayout對準中心並增加孩子之間的相同幅度。

贊一個:

enter image description here