2016-07-06 2 views
0
Android Studio 2.1.1 

이것은 아래의 현재 XML과 관련되어 있습니다. enter image description heregridlayout의 열 정렬

그러나 이것은 내 예상입니다. enter image description here

"LAST_SALE $ 230"TextView를 아이콘 옆에 정렬하려고합니다. 그러나 "LAST SALE .."은 2 열에 있고 아이콘은 1 열에 있습니다.

GridLayout에서 이렇게 할 수 있습니까? 어떤 제안에 대한

많은 감사,

나는 GridLayout과를 사용하고이는 아이콘과 텍스트로 새의 LinearLayout을 작성하여이 작업을 수행 할 관리 내 XML

android.support.v7.widget.GridLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:columnCount="3" 
    app:rowCount="5"> 

    <!-- Row 1 --> 
    <ImageView 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_marginStart="8dp" 
     android:id="@+id/ivOptions" 
     android:src="@drawable/ic_remove_circle_outline_black_24dp"/> 

    <TextView 
     android:id="@+id/tvSize" 
     app:layout_columnSpan="2" 
     android:text="Size 8.0/ Tubular Doom Primeknit Core Black" 
     android:textSize="14sp" 
     android:textColor="@android:color/black" 
     android:fontFamily="sans-serif-condensed"/> 

    <!-- Row 2 --> 
    <TextView 
     android:id="@+id/tvPartNumber" 
     app:layout_column="1" 
     app:layout_columnSpan="2" 
     android:text="S74921" 
     android:textSize="12sp" 
     app:layout_row="1" /> 

    <!-- Row 3 --> 
    <ImageView 
     android:id="@+id/ivSneaker" 
     android:layout_width="80dp" 
     android:layout_height="50dp" 
     app:layout_gravity="center" 
     app:layout_columnWeight="1" 
     android:src="@drawable/sneakers_200" 
     android:scaleType="fitXY"/> 

    <include 
     android:id="@+id/top_offers" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     app:layout_gravity="center" 
     layout="@layout/top_offers"/> 

    <include 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     app:layout_gravity="center" 
     app:layout_columnWeight="1" 
     layout="@layout/offers_button"/> 

    <!-- Row 4 --> 
    <ImageView 
     android:layout_width="wrap_content" 
     app:layout_column="1" 
     android:layout_marginEnd="8dp" 
     android:src="@drawable/ic_trending_down_black_24dp"/> 

    <TextView 
     android:id="@+id/tvLastSale" 
     app:layout_gravity="center_vertical" 
     android:text="LAST SALE $230"/> 
</android.support.v7.widget.GridLayout> 

답변

0

입니다. 그런 다음 1 열에 포함 :

<!-- Row 4 --> 
<include 
    app:layout_column="1" 
    layout="@layout/last_sale_row"/>