8

के शीर्ष पर फ़्लोटिंग एक्शन बटन को कैसे जोड़ा जाए मेरे पास एक फ़्लोटिंग एक्शन बटन है जिसे मैं स्क्रॉलव्यू के शीर्ष पर जोड़ना चाहता हूं ताकि बटन स्क्रॉल हो, भले ही आप स्क्रॉल करें। मैं इसे स्क्रॉलव्यू के शीर्ष पर और स्क्रीन के निचले दाएं कोने में चाहता हूं। इसे पूरा करने के लिए मुझे किन विचारों का संयोजन करने की आवश्यकता है?स्क्रॉलव्यू

यहाँ xml फ़ाइल है:

एंड्रॉयड:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:fab="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.nhscoding.safe2tell.STORIES" 
    android:background="@color/stor_back"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="bottom" 
     > 

     <com.getbase.floatingactionbutton.FloatingActionButton 
      android:id="@+id/pink_icon" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      fab:fab_icon="@drawable/ic_add" 
      fab:fab_colorNormal="@color/fab_back" 
      fab:fab_colorPressed="@color/fab_pressed_back" 
      android:layout_gravity="end" 
      android:layout_marginBottom="16dp" 
      android:layout_marginRight="16dp"/> 
     </LinearLayout> 


    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 



      <android.support.v7.widget.CardView 
       xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       > 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card1_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title1" 
        /> 


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

      <android.support.v7.widget.CardView 
       xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view2" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       android:layout_below="@id/card_view1"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card2_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        /> 

       <TextView 
        android:id="@+id/info_text2" 
        android:layout_marginTop="16dp" 
        android:layout_marginBottom="0dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"/> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view3" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       android:layout_below="@id/card_view2"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card3_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        /> 

       <TextView 
        android:id="@+id/info_text3" 
        android:layout_marginTop="16dp" 
        android:layout_marginBottom="0dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent"/> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card4_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title4" 
        /> 


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

      <android.support.v7.widget.CardView 
       xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="16dp" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card5_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title5" 
        /> 


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


      </LinearLayout> 
     </ScrollView> 




</RelativeLayout> 
+0

एक्सएमएल में 'स्क्रॉलव्यू' के बाद अपने एफएबी को ले जाएं। बाद में 'रिलेवेटिवआउट' में बच्चे जेड अक्ष पर पहले के बच्चों पर तैरते थे, हालांकि एंड्रॉइड 5.0 की ऊंचाई सामग्री भी यहां खेलती है। – CommonsWare

+0

धन्यवाद! यह काम करता है @ कॉमन्सवेयर – user3566841

उत्तर

11

बाद में RelativeLayout में बच्चेमें पहले के बच्चों पर तैरते हैं।

(मैं कहता हूँ क्योंकि Android 5.0 के elevation सामान भी एक भूमिका निभाता है, और उन दोनों के बीच संबंध ख़राब ढंग से परिभाषित कि "के लिए करते हैं") तो

, एक RelativeLayout में एक ScrollView पर एक फैब नाव के लिए , सुनिश्चित करें कि ScrollView को पहले एक्सएमएल में परिभाषित किया गया है, इसके बाद एफएबी के साथ। यह एक्स/वाई नियमों को प्रभावित नहीं करेगा, लेकिन यह Z अक्ष पर ScrollView पर FAB दिखाई देना चाहिए।

एक और संभावना, यदि आप केवल एंड्रॉइड 5.0+ का समर्थन कर रहे हैं, तो एफएबी बढ़ाने के लिए android:elevation का उपयोग करना होगा।

+0

हाय @ कॉमन्सवेयर कृपया मेरे प्रश्न में मेरी मदद करें क्योंकि मैं उस पर काम कर रहा था लेकिन छवि में प्रदान किए गए लेआउट को करने में सक्षम नहीं हूं: http://stackoverflow.com/questions/31238880/create-the- लेआउट-साथ-कार्डव्यू-एंड-फ्लोटिंग-एक्शन-बटन-एंड्रॉइड –

+0

जेनियस मैन .... – Tarun

+0

ठीक काम करता है धन्यवाद –

9

इस कोशिश layout_alignParentRight = "true"

एंड्रॉयड: layout_alignParentBottom = "true"

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:fab="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.nhscoding.safe2tell.STORIES" 
    android:background="@color/stor_back"> 


    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 


      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card1_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title1" /> 


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

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view2" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       android:layout_below="@id/card_view1"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card2_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" /> 

       <TextView 
        android:id="@+id/info_text2" 
        android:layout_marginTop="16dp" 
        android:layout_marginBottom="0dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view3" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       android:layout_below="@id/card_view2"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card3_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" /> 

       <TextView 
        android:id="@+id/info_text3" 
        android:layout_marginTop="16dp" 
        android:layout_marginBottom="0dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card4_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title4" /> 


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

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="16dp" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card5_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title5" /> 


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


     </LinearLayout> 
    </ScrollView> 

     <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="bottom" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentBottom="true" 
     android:layout_margin="10dp"> 

     <com.getbase.floatingactionbutton.FloatingActionButton 
      android:id="@+id/pink_icon" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      fab:fab_icon="@drawable/ic_add" 
      fab:fab_colorNormal="@color/fab_back" 
      fab:fab_colorPressed="@color/fab_pressed_back" 
      android:layout_gravity="end" 
      android:layout_marginBottom="16dp" 
      android:layout_marginRight="16dp" /> 
    </LinearLayout> 

</RelativeLayout> 
0

आप पेरेंट लेआउट के रूप में android.support.design.widget.CoordinatorLayout का उपयोग कर सकते हैं। दो एक्सएमएल बनाएं जिसमें आप स्क्रॉलबार या सूची सेट कर सकते हैं। अन्य माता-पिता कंटेनर हैं जो आपकी जानकारी को FloatingActionButton के साथ रखते हैं।

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context=".MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_main" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|end" 
     app:elevation="6dp" 
     app:backgroundTint="@color/colorAccent" 
     app:pressedTranslationZ="12dp" 
     android:layout_margin="@dimen/fab_margin" 
     android:src="@drawable/ic_add" /> 

</android.support.design.widget.CoordinatorLayout> 

content_main.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:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:gravity="center" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/activity_main" 
    tools:context=".MainActivity"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 


      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card1_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title1" /> 


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

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view2" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       android:layout_below="@id/card_view1"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card2_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" /> 

       <TextView 
        android:id="@+id/info_text2" 
        android:layout_marginTop="16dp" 
        android:layout_marginBottom="0dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view3" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius" 
       android:layout_below="@id/card_view2"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card3_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" /> 

       <TextView 
        android:id="@+id/info_text3" 
        android:layout_marginTop="16dp" 
        android:layout_marginBottom="0dp" 
        android:layout_marginLeft="16dp" 
        android:layout_marginRight="16dp" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="@dimen/card_margin_bottom" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card4_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title4" /> 


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

      <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/card_view1" 
       android:layout_width="match_parent" 
       android:layout_height="200dp" 
       android:layout_marginTop="@dimen/card_margin_top" 
       android:layout_marginBottom="16dp" 
       android:layout_marginLeft="@dimen/card_margin_left" 
       android:layout_marginRight="@dimen/card_margin_right" 
       card_view:cardCornerRadius="@dimen/card_radius"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/card_title_top" 
        android:layout_marginBottom="@dimen/card_title_bottom" 
        android:layout_marginLeft="@dimen/card_title_left" 
        android:layout_marginRight="@dimen/card_title_right" 
        android:text="@string/card5_title" 
        android:textSize="@dimen/card_title_size" 
        android:gravity="top" 
        android:id="@+id/title5" /> 


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


     </LinearLayout> 
    </ScrollView> 
</RelativeLayout>