A
AlexxxBcN
Gamma
Verificado por Whatsapp
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola , quiero añadir este efecto : CollapsingToolbarLayout , pero no se en que apartado ponerlo para hacerlo funcionar .
Mi layout funciona , pero desconozco si está bien organizado , alguna ayuda o idea ? Gracias !!!
Esto es lo que quiero añadir:
Mi Layout
Mi layout funciona , pero desconozco si está bien organizado , alguna ayuda o idea ? Gracias !!!
Esto es lo que quiero añadir:
Insertar CODE, HTML o PHP:
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="@dimen/shrine_toolbar_offset_start"
app:expandedTitleMarginTop="@dimen/shrine_toolbar_offset_top"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
</com.google.android.material.appbar.CollapsingToolbarLayout>
Mi Layout
Insertar CODE, HTML o PHP:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.AppBarLayout
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/appBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
android:nestedScrollingEnabled="true">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:nestedScrollingEnabled="true"
app:logo="@mipmap/ic_launcher"
app:layout_scrollFlags="scroll|enterAlways">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:textSize="22sp"
android:textColor="#ffffff"
tools:ignore="RtlHardcoded" />
</androidx.appcompat.widget.Toolbar>
<androidx.core.widget.NestedScrollView
android:clipToPadding="true"
android:fillViewport="true"
android:fitsSystemWindows="true"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:background="#E0E0E0"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.myapp.new.RestaurantDetailActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:background="#E0E0E0">
<RelativeLayout
android:id="@+id/restaurant_top_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:elevation="300dp">
<ImageView
android:id="@+id/restaurant_image"
android:layout_width="match_parent"
android:layout_height="300dp"
android:alpha="1.0"
android:scaleType="centerCrop"
tools:src="@drawable/food_1"
android:contentDescription="TODO" />
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/gradient_up" />
<!-- Back button -->
<ImageView
android:id="@+id/restaurant_button_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:layout_alignLeft="@+id/restaurant_name"
android:layout_marginTop="16dp"
app:srcCompat="@drawable/ic_close_white_24px"
android:visibility="gone"
android:contentDescription="TODO" />
<TextView
android:id="@+id/restaurant_name"
style="@style/AppTheme.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/restaurant_rating"
android:layout_marginLeft="8dp"
android:layout_marginTop="158dp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:text="Some Restaurant" />
<me.zhanghai.android.materialratingbar.MaterialRatingBar
android:id="@+id/restaurant_rating"
style="@style/Widget.MaterialRatingBar.RatingBar.Indicator"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_above="@+id/restaurant_category"
android:layout_alignStart="@+id/restaurant_name"
app:mrb_progressTint="@android:color/white"
app:mrb_secondaryProgressTint="@android:color/white" />
<TextView
android:id="@+id/restaurant_num_ratings"
style="@style/AppTheme.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/restaurant_rating"
android:layout_alignTop="@+id/restaurant_rating"
android:layout_marginStart="4dp"
android:layout_toEndOf="@+id/restaurant_rating"
android:gravity="center"
android:textColor="@android:color/white"
tools:text="(10)" />
<TextView
android:id="@+id/restaurant_category"
style="@style/AppTheme.Subheader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/restaurant_image"
android:layout_alignStart="@+id/restaurant_name"
android:layout_marginBottom="8dp"
android:layout_marginTop="0dp"
android:textColor="@android:color/white"
tools:text="Italian" />
<TextView
android:id="@+id/restaurant_city_divider"
style="@style/AppTheme.TextDivider"
android:layout_alignTop="@+id/restaurant_category"
android:layout_toRightOf="@+id/restaurant_category"
android:text="@string/divider_bullet"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/restaurant_city"
style="@style/AppTheme.Subheader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/restaurant_category"
android:layout_below="@+id/restaurant_category"
android:layout_toEndOf="@+id/restaurant_city_divider"
android:textColor="@android:color/white"
tools:text="San Francisco" />
<!-- Back button <TextView
android:id="@+id/restaurant_price"
style="@style/AppTheme.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/restaurant_name"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:text="$$$" /> -->
<Button
android:id="@+id/button_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/apply"
android:theme="@style/ThemeOverlay.FilterButton" />
<TextView
android:id="@+id/restaurant_direccion"
style="@style/AppTheme.Body3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginStart="8dp"
android:layout_marginTop="310dp"
android:textColor="@android:color/holo_blue_dark"
android:textStyle="normal"
tools:text="direccion" />
<TextView
android:id="@+id/restaurant_descripcion"
style="@style/AppTheme.Body3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:layout_marginStart="8dp"
android:layout_marginTop="342dp"
android:textColor="@android:color/black"
android:textStyle="normal"
tools:text="Descripcion" />
<TextView
android:id="@+id/restaurant_whatsapp"
style="@style/AppTheme.Body3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:layout_marginBottom="18dp"
android:layout_marginEnd="16dp"
android:layout_alignParentEnd="true"
android:textColor="@android:color/holo_green_dark"
android:textStyle="normal"
tools:text="Whatsapp" />
</RelativeLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_show_rating_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/restaurant_top_card"
android:layout_alignParentRight="true"
android:layout_marginBottom="-48dp"
android:layout_marginRight="16dp"
app:srcCompat="@drawable/cm"
app:tint="@android:color/white"
android:clickable="true"
/>
<!-- Ratings -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_ratings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/restaurant_top_card"
android:background="@android:color/transparent"
android:clipToPadding="true"
android:paddingBottom="16dp"
android:paddingTop="38dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:listitem="@layout/item_rating" />
<!-- View for empty ratings -->
<LinearLayout
android:id="@+id/view_empty_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/restaurant_top_card"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
android:descendantFocusability="blocksDescendants"
tools:visibility="visible">
<TextView
style="@style/AppTheme.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_no_reviews"
android:textColor="@color/greyDisabled" />
</LinearLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</com.google.android.material.appbar.AppBarLayout>