2017-12-25 10 views
0

私のイメージはマージンボトムのレイアウトの上にある必要があるので、私は必要なものを作るためにフレームレイアウトを使用しようとしましたが、私のイメージはframelayoutボーダーを残すことができません。相対レイアウトを使用しようとするよりも、同じ問題があります。私はstackoverflowの上でいくつかの記事を読んで、私はすべての記事は、私は必要なものレイヤリング - どのように?

「どのようにビューの上に画像を作る」についてでした、解決策を見つけることができませんでした:

enter image description here

ここに私がしようとする方法です:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:gravity="center_horizontal" 
android:orientation="vertical" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:background="@color/colorPrimaryDark" 
tools:context="com.partyticket.root.partytickets.LoginActivity"> 

<!-- Login progress --> 
<ProgressBar 
    android:id="@+id/login_progress" 
    style="?android:attr/progressBarStyleLarge" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="8dp" 
    android:visibility="gone" /> 


<RelativeLayout 
    android:id="@+id/containerLayout" 
    android:layout_centerVertical="true" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    android:background="@color/colorPrimary" 
    > 
    <LinearLayout 
     android:id="@+id/email_login_form" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 


      <EditText 
       style="@style/App_EditTextStyle" 
       android:id="@+id/email" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="@string/prompt_email" 
       android:layout_marginRight="10dp" 
       android:layout_marginLeft="10dp" 
       android:layout_marginBottom="7dp" 
       android:inputType="textEmailAddress" 
       android:maxLines="1" 
       android:singleLine="true" /> 

      <EditText 
       style="@style/App_EditTextStyle" 
       android:id="@+id/password" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="@string/prompt_password" 
       android:imeActionId="6" 
       android:layout_marginRight="10dp" 
       android:layout_marginLeft="10dp" 
       android:imeActionLabel="@string/action_sign_in_short" 
       android:imeOptions="actionUnspecified" 
       android:inputType="textPassword" 
       android:maxLines="1" 
       android:singleLine="true" /> 


     <Button 
      android:id="@+id/email_sign_in_button" 
      style="?android:textAppearanceSmall" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="16dp" 
      android:text="@string/action_sign_in" 
      android:textStyle="bold" /> 

    </LinearLayout> 

</RelativeLayout> 

<ImageView 
    android:layout_width="81dp" 
    android:layout_height="81dp" 
    android:layout_above="@+id/containerLayout" 
    android:layout_marginTop="42dp" 
    android:src="@drawable/partytickets_small_logo" /> 
</RelativeLayout> 

答えて

1

使用コーディネーターレイアウトの代わりに、相対的なレイアウトとあなたのImageViewの次

app:layout_anchor="@id/your Layout Wich Will Be under the Image" 
app:layout_anchorGravity="center_horizontal" 
を使用しての属性により

希望があれば、私が知る唯一の方法です。

+0

正しいですが、 'anchorGracity'は' center_horizo​​ntal'である必要があります。ありがとうございました – Toper

+0

あなたが歓迎して、うれしかった、他の人のために言ったように私の答えを修正します – Kmelliti

0

あなたの画像に標高属性を使用してみませんか?