8

Ich habe eine Floating-Action-Taste, die ich über eine Scrollview hinzufügen möchte, so dass die Schaltfläche bleibt, auch wenn Sie scrollen. Ich möchte es oben auf dem Scrollview und in der unteren rechten Ecke des Bildschirms. Welche Kombination von Ansichten muss ich verwenden, um dies zu erreichen? HierWie füge ich Floating Action Button über Scrollview hinzu

ist die XML-Datei:

<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

Verschieben Sie Ihre FAB nach dem 'ScrollView' in der XML. Spätere Kinder in einem 'RelativeLayout' schweben über früheren Kindern auf der Z-Achse, obwohl auch das Elevation-Material von Android 5.0 hier spielt. – CommonsWare

+0

Danke! Das hat funktioniert @CommonsWare – user3566841

Antwort

11

Später Kinder in einem RelativeLayout neigen dazu, über frühere Kinder in einemzu schweben.

(ich sage „neigen dazu,“ weil Android 5.0 des elevation Sachen auch eine Rolle spielt, und die Beziehung zwischen ihnen ist schlecht definiert)

, also über einen ScrollView einen FAB Schwimmer zu haben in einem RelativeLayout Stellen Sie sicher, dass die ScrollView zuerst im XML definiert ist, mit dem FAB danach. Dies hat keine Auswirkungen auf die X/Y-Regeln, aber es sollte der FAB über der ScrollView auf der Z-Achse erscheinen.

Eine andere Möglichkeit, wenn Sie nur Android 5.0+ unterstützen, wäre es, android:elevation selbst zu verwenden, um den FAB zu erhöhen.

+0

Hallo @CommonsWare Bitte helfen Sie mir in meiner Frage, wie ich daran gearbeitet wurde, aber nicht in der Lage, das Layout zu tun, das ich im Bild wie folgt zur Verfügung gestellt: http://stackoverflow.com/questions/31238880/create-the- layout-with-cardview-und-schwimm-action-button-android –

+0

Genious man .... – Tarun

+0

funktioniert gut danke –

9

versuchen, dieses:

android: layout_alignParentRight = "true"

android: 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

Sie können android.support.design.widget.CoordinatorLayout als übergeordnetes Layout verwenden. Erstellen Sie zwei XML-Dateien, in denen Sie eine Bildlaufleiste oder eine Liste festlegen können. Andere ist Eltern-Container, die die gesamte Info mit Ihrer FloatingActionButton halten.

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

Hier können Sie Ihre ScrollBar setzen. Es ist ziemlich einfach.

<?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> 
Verwandte Themen