2017-03-06 11 views
0

親レイアウトとして直線レイアウトを作成し、この親線形レイアウト内に相対レイアウトを作成しました。この相対レイアウトをピンクの色でリニアレイアウト の下部には、ここに私のxmlファイル下の線図レイアウトに相対レイアウトを配置する方法

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    tools:context="abtech.waiteriano.com.waitrer.MenuActivity"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="?attr/colorPrimary" 
     android:minHeight="?attr/actionBarSize" /> 

    <!-- A RecyclerView with some commonly used attributes --> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"></FrameLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:background="#ff6b6b" 
     android:gravity="bottom" 
     android:layout_alignParentBottom="true"> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:background="#ff6b6b" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentEnd="true"> 

      <ImageView 
       android:id="@+id/imageView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_centerVertical="true" 
       android:layout_gravity="center" 
       android:src="@drawable/fire" /> 
     </RelativeLayout> 
    </RelativeLayout> 


</LinearLayout> 

View problem

+0

を交換してください下のほうにある相対レイアウトと上にあるツールバーの間に配置します。 または Recyclerview + framelayout両方ですか? –

+0

あなたの興味のために@Deep Patel私はちょうどこれが欲しいRelativeレイアウトは、それがトップにあるべきであるツールバーについての線形レイアウトの一番下に示されています私はちょうどこのrelativelayoutのボタンまたは相対レイアウトからこの相対レイアウトを入れたい –

答えて

0

試してみてください。このコードだ

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
tools:context="abtech.waiteriano.com.waitrer.MenuActivity"> 
<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimary" 
    android:minHeight="?attr/actionBarSize" /> 
<!-- <FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_width="matc 
    h_parent" 
    android:layout_height="wrap_content"></FrameLayout>--> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="bottom"> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/relativeLayout"/> 
    <RelativeLayout 
     android:id="@+id/relativeLayout" 
     android:layout_width="fill_parent" 
     android:layout_height="60dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentEnd="true" 
     android:background="#ff6b6b"> 
     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:layout_gravity="center" 
      android:src="@drawable/fire" /> 
    </RelativeLayout> 
</RelativeLayout> 

+0

ありがとうございました@Rahul Giradkar実際に私が必要なもの –

+0

@ Dev.7arooneyこの回答を受け入れる –

+0

しかし、相対レイアウトがリストビューの下に表示されるという問題があります。これはリストの下に表示する必要があります。つまり、フレームレイアウト@Rahul Giradkar 、私の編集をチェックしてください私は画像に問題を投稿します –

0
<LinearLayout 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:orientation="vertical" 
    tools:context="abtech.waiteriano.com.waitrer.MenuActivity"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="?attr/colorPrimary" 
     android:minHeight="?attr/actionBarSize" /> 

    <!-- A RecyclerView with some commonly used attributes --> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" <-----changed here 
     android:layout_weight="1"> <-----and here 

    </FrameLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:background="#ff6b6b"> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:background="#ff6b6b" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentEnd="true"> 

      <ImageView 
       android:id="@+id/imageView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_centerVertical="true" 
       android:layout_gravity="center" 
       android:src="@drawable/fire" /> 
     </RelativeLayout> 
    </RelativeLayout> 
</LinearLayout> 
0
<LinearLayout 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:orientation="vertical"> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 

    android:minHeight="?attr/actionBarSize" /> 

<!-- A RecyclerView with some commonly used attributes --> 
<FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginBottom="60dp"> 

    </android.support.v7.widget.RecyclerView> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:background="#ff6b6b" 
     android:layout_gravity="bottom" 
     android:layout_alignParentBottom="true"> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:background="#ff6b6b" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentEnd="true"> 

      <ImageView 
       android:id="@+id/imageView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_centerVertical="true" 
       android:layout_gravity="center" 
       /> 
     </RelativeLayout> 
    </RelativeLayout> 
</FrameLayout> 

0

あなたのレイアウトが、それはあなたの問題を解決するこれを試してビットを変更持っています。

<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="wrap_content" 
android:orientation="vertical"> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimary" 
    android:minHeight="?attr/actionBarSize" /> 

<!-- A RecyclerView with some commonly used attributes --> 
<FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_below="@+id/toolbar" 
    android:layout_above="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"></FrameLayout> 

<RelativeLayout 
    android:id="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="60dp" 
    android:background="#ff6b6b" 
    android:layout_alignParentBottom="true"> 



     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:layout_gravity="center" 
      android:src="@mipmap/ic_launcher" /> 
    </RelativeLayout> 

0

あなたの目標を達成するために、以下の使用..

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 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:orientation="vertical" 
> 
<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="?attr/colorPrimary" 
    android:minHeight="?attr/actionBarSize" /> 
<!-- A RecyclerView with some commonly used attributes --> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
    </FrameLayout> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:layout_alignParentBottom="true" 
     android:background="#ff6b6b" 
     android:gravity="bottom"> 
     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:layout_alignParentTop="true" 
      android:background="#ff6b6b"> 
      <ImageView 
       android:id="@+id/imageView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_centerVertical="true" 
       android:layout_gravity="center" 
       android:src="@drawable/ic_log_arrow" /> 
     </RelativeLayout> 
    </RelativeLayout> 
</RelativeLayout> 

0

でrecyclerviewがあり、あなたのコード

<LinearLayout 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:orientation="vertical" 
    tools:context="abtech.waiteriano.com.waitrer.MenuActivity"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="?attr/colorPrimary" 
     android:minHeight="?attr/actionBarSize" /> 

    <!-- A RecyclerView with some commonly used attributes --> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"></FrameLayout> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:background="#ff6b6b"> 

      <ImageView 
       android:id="@+id/imageView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_centerVertical="true" 
       android:layout_gravity="center" 
       android:src="@drawable/fire" /> 
     </RelativeLayout> 


</LinearLayout> 
関連する問題