2016-05-02 2 views
1

Я пытаюсь создать макет продукта для Android. В нижнем колонтитуле есть две кнопки фиксированной кнопки. вы можете видеть изображения, когда я прокручиваю нижние две кнопки, прикрепленные в моем макете. Пожалуйста, помогите, как я могу это сделать?android: NestedScrollview внизу две кнопки прилагается

Изображение 1

enter image description here

Изображение 2

после прокрутки

enter image description here

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:id="@+id/coordinate" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.chivazo.chivazoandroid.activities.SingleProductActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/app_bar_height" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/toolbar_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:expandedTitleMarginBottom="30dp" 
      app:expandedTitleMarginEnd="64dp" 
      app:expandedTitleMarginStart="48dp" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <ImageView 
       android:id="@+id/backdrop" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       android:scaleType="centerCrop" 
       android:src="@drawable/a" 
       app:layout_collapseMode="parallax" /> 

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

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

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


    <LinearLayout 
     android:id="@+id/groupbutton" 
     android:weightSum="2" 
     android:orientation="horizontal" 
     android:layout_gravity="bottom" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 
     <android.support.v7.widget.AppCompatButton 
      android:layout_weight="1" 
      android:id="@+id/share" 
      android:text="share" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
     <android.support.v7.widget.AppCompatButton 
      android:layout_weight="1" 
      android:id="@+id/go_wishlist" 
      android:text="go to Wishlist" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 


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

ответ

7

Вы можете использовать Relativelayout в качестве внешней компоновки и держать CoordinatorLayout внутри него, сделать две кнопки android:layout_alignParentBottom="true"

<?xml version="1.0" encoding="utf-8"?> 

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

    <android.support.design.widget.CoordinatorLayout 
     android:id="@+id/coordinate" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/groupbutton" 
     android:fitsSystemWindows="true" 
     tools:context="com.chivazo.chivazoandroid.activities.SingleProductActivity"> 

     <android.support.design.widget.AppBarLayout 
      android:id="@+id/app_bar" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/app_bar_height" 
      android:fitsSystemWindows="true" 
      android:theme="@style/AppTheme.AppBarOverlay"> 

      <android.support.design.widget.CollapsingToolbarLayout 
       android:id="@+id/toolbar_layout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       app:contentScrim="?attr/colorPrimary" 
       app:expandedTitleMarginBottom="30dp" 
       app:expandedTitleMarginEnd="64dp" 
       app:expandedTitleMarginStart="48dp" 
       app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

       <ImageView 
        android:id="@+id/backdrop" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:fitsSystemWindows="true" 
        android:scaleType="centerCrop" 
        android:src="@drawable/a" 
        app:layout_collapseMode="parallax" /> 

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

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

     <include layout="@layout/content_single_product" /> 
    </android.support.design.widget.CoordinatorLayout> 

    <LinearLayout 
     android:id="@+id/groupbutton" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_gravity="bottom" 
     android:orientation="horizontal" 
     android:weightSum="2"> 

     <android.support.v7.widget.AppCompatButton 
      android:id="@+id/share" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="share" /> 

     <android.support.v7.widget.AppCompatButton 
      android:id="@+id/go_wishlist" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="go to Wishlist" /> 
    </LinearLayout> 
</RelativeLayout> 
+0

Я уже реализовать с помощью кода Java, благодаря, но не идеальный способ –

+0

@SonuKumar вы можете, пожалуйста, помогите, чтобы создать путь, в котором вы были в состоянии достигнуть этого –

+0

HTTP://stackoverflow.com/questions/32465548/add-app-bar-scrolling-view-behavior-to-multiple-views-in-coordinatorlayout проверить эту ссылку appbarlayout app: layout_behaviour –

1

Просто добавьте макет в Coordinatorlayout ниже NestedScrollView в XML и выполните следующие действия в Java.

CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) layoutToBeAnchored.getLayoutParams(); 
    layoutParams.setAnchorId(R.id.layoutBelowWhichToBeAnchored); 
    layoutParams.anchorGravity = Gravity.CENTER; 
    layoutToBeAnchored.setLayoutParams(layoutParams); 

Надеюсь, это поможет вам, ребята. Для любой ссылки можно проверить пример в - https://github.com/IsUncommon/Droidcon-India-2015

+0

спасибо координатору макет уже имеет два представления не требуется другой вид –

+0

@SonuKumar, но я думаю, это правильно решает вашу цель? –

+0

@AnkitPachouri Спасибо –

0

Если включен макет layout="@layout/content_single_product" содержит NestedScrollView как вид корневого контейнера. Попробуйте добавить к нему id, например @+id/nestedView с android:layout_height="match_parent", Возможно, вы должны добавить нижнюю прокладку с одинаковым значением высоты ваших кнопок и просто сохранить остальное как есть, и заменить android:layout_gravity="bottom" внутри вашего нижнего линейного макета, который содержит два кнопки с:

app:layout_anchor="@id/nestedView" app:layout_anchorGravity="bottom"

1

app:layout_anchor="@id/anchor_view" и app:layout_anchorGravity="bottom"
являются важными атрибутами здесь

<android.support.design.widget.CoordinatorLayout 
      android:id="@+id/coordinator_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      tools:context=".ProductDetailActivity"> 

    <android.support.design.widget.AppBarLayout 
      android:id="@+id/app_bar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

    <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:layout_scrollFlags="scroll"> 

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

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

    <android.support.v4.widget.NestedScrollView 
       android:id="@+id/nested_scroll" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
       . 
       . 
       . 

       <View 
       android:id="@+id/anchor_view" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 
       . 
       . 
       . 
       . 
     </android.support.v4.widget.NestedScrollView> 

    <LinearLayout 

       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       app:layout_anchor="@id/anchor_view" 
       app:layout_anchorGravity="bottom"> 

       <Button 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="1"/> 


       <Button 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="1"/> 
      </LinearLayout> 
    </android.support.design.widget.CoordinatorLayout> 
0
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.CoordinatorLayout 
     android:id="@+id/coordinatorLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     android:orientation="vertical"> 



     <android.support.design.widget.AppBarLayout 
      android:id="@+id/appBarLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

      <android.support.design.widget.CollapsingToolbarLayout 
       android:id="@+id/collapsing_toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@android:color/transparent" 
       app:contentScrim="?attr/colorPrimary" 
       app:expandedTitleGravity="center_vertical|start" 
       app:expandedTitleTextAppearance="@android:color/transparent" 
       app:layout_collapseMode="parallax" 
       app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

       <RelativeLayout 
        android:id="@+id/lay_image_slider" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/browseCategories" 
        android:background="@color/white"> 

        <FrameLayout 
         android:id="@+id/rel" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:background="@android:color/white" 
         android:orientation="vertical"> 

         <com.example.android_dev.ecm.View.ViewPagerCustomDuration 
          android:id="@+id/pager" 
          android:layout_width="fill_parent" 
          android:layout_height="300dp" /> 

         <com.example.android_dev.ecm.View.CirclePageIndicator 
          android:id="@+id/indicator" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:layout_gravity="bottom" 
          android:background="@android:color/transparent" 
          android:padding="10dp" /> 
        </FrameLayout> 
       </RelativeLayout> 

       <android.support.v7.widget.Toolbar 
        android:id="@+id/toolbarSeller" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        android:minHeight="56dp" 
        app:layout_collapseMode="pin" /> 


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

     <include 
      android:id="@+id/contentScroll" 
      layout="@layout/content_scroll_product_detail" /> 
    </android.support.design.widget.CoordinatorLayout> 


    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_gravity="bottom" 
     android:orientation="vertical"> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="8dp" 
      android:layout_gravity="center" 
      android:background="@drawable/shadow" /> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:weightSum="2"> 

      <Button 
       android:id="@+id/addToCart" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:background="@color/white" 
       android:text="Add To Cart" 
       android:textColor="@color/black" 
       android:textSize="16sp" /> 

      <!--<Button 
       android:id="@+id/addToWishList" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:background="@color/colorAccent" 
       android:text="Add To Wishlist" 
       android:textColor="@color/white" />--> 

      <Button 
       android:id="@+id/buyNow1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:background="@color/colorPrimary" 
       android:text="Buy Now" 
       android:textColor="@color/white" 
       android:textSize="16sp" /> 

     </LinearLayout> 

    </LinearLayout> 
</RelativeLayout> 

content_scroll_product_detail.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:expandableTextView="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_behavior="com.example.android_dev.ecm.Helper.FixedScrollingViewBehaviour"> 

     <android.support.v4.widget.NestedScrollView 
      android:id="@+id/nestedScroll" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

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

       <android.support.v7.widget.CardView 
        android:id="@+id/productDetails" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="5dp"> 

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

         <TextView 
          android:id="@+id/productTitle" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:paddingLeft="10dp" 
          android:paddingRight="10dp" 
          android:paddingTop="10dp" 
          android:textColor="@color/black" 
          android:textSize="18sp" /> 

         <TextView 
          android:id="@+id/productName" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:paddingLeft="10dp" 
          android:paddingRight="10dp" 
          android:paddingTop="2dp" 
          android:textSize="16sp" /> 

         <RelativeLayout 
          android:id="@+id/priceLayout" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:orientation="horizontal"> 

          <TextView 
           android:id="@+id/productDiscountPrice" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_marginLeft="10dp" 
           android:gravity="center" 
           android:paddingLeft="10dp" 
           android:paddingRight="10dp" 
           android:paddingTop="10dp" 
           android:textColor="@color/black" 
           android:textSize="18sp" 
           android:textStyle="bold" /> 

          <TextView 
           android:id="@+id/productPrice" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_marginLeft="10dp" 
           android:layout_toRightOf="@+id/productDiscountPrice" 
           android:gravity="center" 
           android:paddingLeft="10dp" 
           android:paddingRight="10dp" 
           android:paddingTop="10dp" 
           android:textColor="@color/gray" 
           android:textSize="14sp" /> 

          <LinearLayout 
           android:id="@+id/ratingProduct" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_alignParentRight="true" 
           android:layout_marginRight="10dp" 
           android:orientation="horizontal"> 

           <TextView 
            android:id="@+id/rating" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_marginTop="5dp" 
            android:padding="10dp" 
            android:text="3.2" 
            android:textColor="@color/colorAccent" 
            android:textSize="22sp" /> 

           <RatingBar 
            android:id="@+id/star" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_toRightOf="@+id/rating" 
            android:isIndicator="true" 
            android:numStars="1" 
            android:rating="1" /> 
          </LinearLayout> 

          <LinearLayout 
           android:id="@+id/sold" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_below="@+id/productPrice" 
           android:layout_marginLeft="10dp" 
           android:layout_marginTop="10dp" 
           android:orientation="horizontal"> 

           <TextView 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Sold by : " 
            android:textColor="@color/gray" 
            android:textSize="14sp" /> 

           <TextView 
            android:id="@+id/soldBy" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:textColor="@color/gray" 
            android:textSize="14sp" /> 
          </LinearLayout> 

          <TextView 
           android:id="@+id/orders" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_below="@+id/sold" 
           android:layout_marginLeft="10dp" 
           android:layout_marginTop="10dp" 
           android:textSize="20sp" 
           android:textStyle="bold" /> 

         </RelativeLayout> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:paddingLeft="10dp" 
          android:paddingRight="10dp" 
          android:paddingTop="10dp" 
          android:text="Additional tax may apply charged at checkout" 
          android:textSize="14sp" /> 

         <LinearLayout 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:orientation="horizontal" 
          android:paddingTop="10dp" 
          android:weightSum="1"> 

          <Button 
           android:id="@+id/share" 
           android:layout_width="0dp" 
           android:layout_height="wrap_content" 
           android:layout_gravity="center" 
           android:layout_weight="0.5" 
           android:background="@drawable/lay_border" 
           android:drawableLeft="@drawable/shareic" 
           android:drawablePadding="-20dp" 
           android:gravity="center" 
           android:paddingLeft="8dp" 
           android:text="Share" 
           android:textColor="@color/black" /> 

          <Button 
           android:id="@+id/addToWishList" 
           android:layout_width="0dp" 
           android:layout_height="wrap_content" 
           android:layout_gravity="center" 
           android:layout_weight="0.5" 
           android:background="@drawable/lay_border" 
           android:drawableLeft="@drawable/pinic" 
           android:drawablePadding="-10dp" 
           android:gravity="center" 
           android:paddingLeft="8dp" 
           android:text="Add To Pinlist" 
           android:textColor="@color/black" /> 

         </LinearLayout> 

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


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

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

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

       <TextView 
        android:id="@+id/outOfStock" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/ratingSeller" 
        android:background="@color/light_red" 
        android:gravity="center" 
        android:text="Sorry this product is out of stock." 
        android:textColor="@color/white" 
        android:textSize="22sp" 
        android:visibility="gone" /> 

       <android.support.v7.widget.CardView 
        android:id="@+id/productVariants" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/outOfStock" 
        android:layout_marginTop="5dp"> 

        <LinearLayout 
         android:id="@+id/addAttributesHere" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:orientation="vertical"> 

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

       <LinearLayout 
        android:id="@+id/saveButtons" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/productVariants" 
        android:orientation="horizontal" 
        android:visibility="gone" 
        android:weightSum="2"> 

        <Button 
         android:id="@+id/add" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@color/black" 
         android:text="Add To Cart" 
         android:textColor="@color/white" /> 

        <!--  <Button 
           android:id="@+id/save" 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:layout_weight="1" 
           android:background="@color/colorAccent" 
           android:text="Add To Wishlist" 
           android:textColor="@color/white" />--> 

        <Button 
         android:id="@+id/buyNow2" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@color/colorAccent" 
         android:text="Buy Now" 
         android:textColor="@color/white" /> 

       </LinearLayout> 


       <android.support.v7.widget.CardView 
        android:id="@+id/description" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/saveButtons" 
        android:layout_marginTop="2dp"> 

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

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:paddingLeft="10dp" 
          android:paddingRight="10dp" 
          android:text="Description" 
          android:textColor="@color/black" 
          android:textSize="16sp" 
          android:textStyle="bold" /> 

         <com.ms.square.android.expandabletextview.ExpandableTextView 
          android:id="@+id/expand_text_view" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          expandableTextView:animDuration="200" 
          expandableTextView:maxCollapsedLines="2"> 

          <TextView 
           android:id="@+id/expandable_text" 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:paddingLeft="10dp" 
           android:paddingRight="10dp" 
           android:paddingTop="10dp" 
           android:textColor="@color/black" 
           android:textSize="14sp" /> 

          <ImageButton 
           android:id="@id/expand_collapse" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_gravity="right|bottom" 
           android:background="@android:color/transparent" 
           android:padding="16dp" /> 
         </com.ms.square.android.expandabletextview.ExpandableTextView> 
        </LinearLayout> 
       </android.support.v7.widget.CardView> 

       <android.support.v7.widget.CardView 
        android:id="@+id/recommend" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/description" 
        android:layout_marginTop="5dp"> 

        <RelativeLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:background="@color/white"> 

         <TextView 
          android:id="@+id/recommendHead" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:padding="10dp" 
          android:text="Recommendation" 
          android:textColor="@color/black" 
          android:textSize="16sp" 
          android:textStyle="bold" /> 

         <TextView 
          android:id="@+id/recommendText" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_below="@+id/recommendHead" 
          android:padding="10dp" 
          android:text="Would you like to recommend this product?" 
          android:textColor="@color/gray" 
          android:textSize="14sp" /> 

         <LinearLayout 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_below="@+id/recommendText" 
          android:layout_marginBottom="5dp" 
          android:background="@drawable/lay_border" 
          android:weightSum="2"> 

          <Button 
           android:id="@+id/yes" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_gravity="right" 
           android:layout_weight="1" 
           android:background="#deffffff" 
           android:text="Yes" 
           android:textColor="@color/colorPrimary" 
           android:textSize="18sp" /> 

          <Button 
           android:id="@+id/no" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_gravity="left" 
           android:layout_weight="1" 
           android:background="#f7f5f5" 
           android:text="No" 
           android:textColor="@color/colorPrimary" 
           android:textSize="18sp" /> 
         </LinearLayout> 

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

       <android.support.v7.widget.CardView 
        android:id="@+id/productSellers" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/recommend" 
        android:layout_marginTop="5dp"> 

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

         <android.support.v7.widget.RecyclerView 
          android:id="@+id/addSellersHere" 
          android:layout_width="match_parent" 
          android:layout_height="0dp" 
          android:layout_weight="1"> 

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


     </android.support.v4.widget.NestedScrollView> 


    </RelativeLayout> 
+1

Благодарим вас за этот фрагмент кода, который может предоставить некоторую ограниченную немедленную помощь. [Правильное объяснение значительно улучшит его долгосрочную ценность] (// meta.stackexchange.com/q/114762/350567), показывая * почему * это хорошее решение проблемы и сделает его более полезным для будущего читателей с другими подобными вопросами.Пожалуйста, отредактируйте свой ответ, чтобы добавить какое-то объяснение, включая сделанные вами предположения. – iBug

Смежные вопросы