2016-05-21 10 views
1

これは私の支払いファイルです。レイアウトファイルがrecyclerを表示していませんアンドロイドのアイテムを表示

<?xml version="1.0" encoding="utf-8"?> 
<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" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context="com.wokoshop.sony.activity.ActivityShoppingCart"> 

    <include 
     android:id="@+id/toolbar" 
     layout="@layout/toolbar" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     app:layout_scrollFlags="scroll|enterAlways" 
     android:layout_alignParentTop="true"/> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recycler_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:scrollbars="vertical" 
     android:layout_below="@+id/toolbar" 
     android:layout_above="@+id/card_view" 
     /> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/card_view" 
     > 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="8dp" 
      > 

      <CheckBox 
       android:id="@+id/applyWallet" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Apply wallet" 
       android:checked="true" 
       android:layout_above="@+id/mainText" 
       /> 

      <TextView 
       android:id="@+id/mainText" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textSize="18sp" 
       android:textColor="@color/primary_dark" 
       android:layout_centerHorizontal="true" 
       android:layout_above="@+id/placeOrderButton" 
       /> 

      <Button 
       android:id="@+id/placeOrderButton" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:text="PLACE ORDER" 
       android:layout_alignParentBottom="true" 
       /> 
     </RelativeLayout> 

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

</RelativeLayout> 

カードの下部に表示されるアイテムとツールバーが表示されます。しかし、recyclerViewアイテムは表示されません。アイテムはrecyclerViewで利用できますが、レイアウトファイル(表示部分)に何かがありません。

私はここで何が欠けているのですか?

+0

は、ツールバーとカードビューの両方を非表示にするとリサイクル表示アイテムが表示されますか? – Jickson

+0

@Jicksonはい、cardViewを隠すと、recyclerViewアイテムが表示されています。 –

+0

カードビューはどこに置く必要がありますか?それは画面の最下部か、またはリサイクルビューの終わりですか? – Jickson

答えて

0

カードビューでlayout_belowプロパティを設定していません。あなたのrecyclerviewcardview

 <?xml version="1.0" encoding="utf-8"?> 
    <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" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     tools:context="com.wokoshop.sony.activity.ActivityShoppingCart"> 

     <include 
      android:id="@+id/toolbar" 
      layout="@layout/toolbar" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      app:layout_scrollFlags="scroll|enterAlways" 
      android:layout_alignParentTop="true"/> 

     <android.support.v7.widget.CardView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/card_view" 
      android:alignParentBottom="true"> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="8dp" 
       > 

       <CheckBox 
        android:id="@+id/applyWallet" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="Apply wallet" 
        android:checked="true" 
        android:layout_above="@+id/mainText" 
        /> 

       <TextView 
        android:id="@+id/mainText" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textSize="18sp" 
        android:textColor="@color/primary_dark" 
        android:layout_centerHorizontal="true" 
        android:layout_above="@+id/placeOrderButton" 
        /> 

       <Button 
        android:id="@+id/placeOrderButton" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:text="PLACE ORDER" 
        android:layout_alignParentBottom="true" 
        /> 
      </RelativeLayout> 

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

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recycler_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="vertical" 
      android:layout_below="@+id/toolbar" 
      android:layout_above="@+id/card_view" 
      /> 

    </RelativeLayout> 
+0

これは循環依存関係を作成します。 'レンダリング中に例外が発生しました:循環依存関係はRelativeLayoutに存在できません' – Jickson

+0

はい、それは与えてもエラーを出しました。 –

+0

申し訳ありませんが私の質問を誤解...私の編集レイアウトを確認plz。 –

0

これを試してみてくださいと重なっている理由です。..

<?xml version="1.0" encoding="utf-8"?> 
<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" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context="com.wokoshop.sony.activity.ActivityShoppingCart"> 

    <include 
     android:id="@+id/toolbar" 
     layout="@layout/toolbar" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     app:layout_scrollFlags="scroll|enterAlways" 
     android:layout_alignParentTop="true"/> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recycler_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:scrollbars="vertical" 
     android:layout_below="@+id/toolbar" 
     android:layout_above="@+id/card_view" 
     /> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/card_view" 
     android:layout_alignParentBottom="true" 
     > 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="8dp" 
      > 

      <CheckBox 
       android:id="@+id/applyWallet" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Apply wallet" 
       android:checked="true" 
       android:layout_above="@+id/mainText" 
       /> 

      <TextView 
       android:id="@+id/mainText" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textSize="18sp" 
       android:textColor="@color/primary_dark" 
       android:layout_centerHorizontal="true" 
       android:layout_above="@+id/placeOrderButton" 
       /> 

      <Button 
       android:id="@+id/placeOrderButton" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:text="PLACE ORDER" 
       android:layout_alignParentBottom="true" 
       /> 
     </RelativeLayout> 

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

</RelativeLayout> 
+0

Error:(26)cardviewの 'android'パッケージ内の 'alignParentBottom'属性のリソース識別子が見つかりませんでした。私はandroid:layout_alignParentBottom = "true"に置き換えてみました。その同じ結果の後にcardviewだけを表示する、recyclerviewではない –

+0

申し訳ありません.. 'android:layout_alignParentBottom = "true"' – Jickson

+0

@DeveshAgrawalはあなたのためにこの仕事をしましたか? – Jickson

0

私はそれはあなたの問題を解決すると思い、これを試してください.....

<?xml version="1.0" encoding="utf-8"?> 
<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" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
tools:context="com.wokoshop.sony.activity.ActivityShoppingCart"> 

<include 
    android:id="@+id/toolbar" 
    layout="@layout/toolbar" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    app:layout_scrollFlags="scroll|enterAlways" 
    android:layout_alignParentTop="true"/> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_view" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:scrollbars="vertical" 
    android:layout_below="@+id/toolbar" 
    /> 

<android.support.v7.widget.CardView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/card_view" 
    android:layout_below="@+id/recycler_view" 
    > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="8dp" 
     > 

     <CheckBox 
      android:id="@+id/applyWallet" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Apply wallet" 
      android:checked="true" 
      android:layout_above="@+id/mainText" 
      /> 

     <TextView 
      android:id="@+id/mainText" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textSize="18sp" 
      android:textColor="@color/primary_dark" 
      android:layout_centerHorizontal="true" 
      android:layout_above="@+id/placeOrderButton" 
      /> 

     <Button 
      android:id="@+id/placeOrderButton" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="PLACE ORDER" 
      android:layout_alignParentBottom="true" 
      /> 
    </RelativeLayout> 

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

</RelativeLayout> 
関連する問題