2017-09-08 10 views
0

線形レイアウトにビューを揃える方法は?LinearLayoutの左下にビューを揃えますが、上に置いてください

私は青い円が次のようになりたい

:しかし(左下のLinearLayoutの上、しかし白のLinearLayoutの境界線上に維持)

What I want

、私がやろうとしている方法

What I do not want

レイアウトのxml:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:Font="http://schemas.android.com/apk/res-auto" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:id="@+id/notificationItemLayout" 
     android:background="@drawable/layout_border" 
     android:layout_marginLeft="20dp"> 

    <com.mmp.customview.DefaultTextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     Font:isLight="true" 
     android:id="@+id/notificationDataTextView" 
     tools:text="Message log 1/7/2017" 
     android:layout_marginTop="8dp" /> 

     <com.mmp.customview.DefaultTextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      Font:isLight="true" 
      android:textSize="17sp" 
      android:textColor="#A9D3E7" 
      android:id="@+id/notificationTextView" 
      tools:text="Message log 1/7/2017" 
      android:paddingTop="15dp" 
      android:paddingLeft="15dp" 
      android:paddingRight="15dp" 
      android:paddingBottom="10dp" 
      android:layout_marginTop="8dp" /> 

    </LinearLayout> 

    <com.mmp.customview.NotificationIconView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_alignBottom="@+id/notificationItemLayout" 
     android:layout_alignLeft="@+id/notificationItemLayout" 
     android:layout_centerHorizontal="true" 
     android:id="@+id/notificationIcon" /> 

</RelativeLayout> 
それはこのようになります

答えて

1

は、私はあなたがでframeLayoutにあなたのLinearLayoutとアイコンビューを配置する必要があります推測:

<FrameLayout ...> 
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:id="@+id/notificationItemLayout" 
     android:background="@drawable/layout_border" 
     android:layout_marginLeft="20dp"> 

    <com.mmp.customview.DefaultTextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     Font:isLight="true" 
     android:id="@+id/notificationDataTextView" 
     tools:text="Message log 1/7/2017" 
     android:layout_marginTop="8dp" /> 

     <com.mmp.customview.DefaultTextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      Font:isLight="true" 
      android:textSize="17sp" 
      android:textColor="#A9D3E7" 
      android:id="@+id/notificationTextView" 
      tools:text="Message log 1/7/2017" 
      android:paddingTop="15dp" 
      android:paddingLeft="15dp" 
      android:paddingRight="15dp" 
      android:paddingBottom="10dp" 
      android:layout_marginTop="8dp" /> 

    </LinearLayout> 

    <com.mmp.customview.NotificationIconView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_alignBottom="@+id/notificationItemLayout" 
     android:layout_alignLeft="@+id/notificationItemLayout" 
     android:layout_centerHorizontal="true" 
     android:id="@+id/notificationIcon" /> 
</FrameLayout> 

アイコンビューでのLinearLayoutをカバーします。 IconViewを左下に揃え、LinearLayoutの左にパディングを追加します。

関連する問題