【发布时间】:2018-10-21 13:52:34
【问题描述】:
我在 ImageView 的顶部有两个 FAB(FAB:浮动操作按钮),在另一个 ImageView 的右下角有一个
我的问题是我正在尝试修复顶部的 FAB,而另一个可滚动。但是,我得到的结果与我想要的相反。我尝试从ScrollView 中取出一个FAB,但它仍然无法正常工作,因为两个FAB 最初都会在ImageView 之上。
我的布局:
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary"
xmlns:android="http://schemas.android.com/apk/res/android" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
>
<android.support.v4.view.ViewPager
android:id="@+id/detail_page_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<LinearLayout
android:id="@+id/SliderDots"
android:orientation="horizontal"
android:layout_gravity="bottom"
android:layout_marginBottom="10dp"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.CardView
android:layout_width="50dp"
android:layout_height="50dp"
app:cardBackgroundColor="@color/White"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
app:cardCornerRadius="60dp">
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:fabSize="normal"
android:src="@drawable/ic_arrow_back_black_24dp"
android:adjustViewBounds="true"
android:layout_gravity="top"/>
</android.support.v7.widget.CardView>
</FrameLayout>
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/viewB"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="vertical">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/detail_page_text1"
android:textSize="20sp"
android:textColor="@color/White"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"/>
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/detail_page_text2"
android:textColor="@color/White"
android:textSize="16sp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"/>
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/detail_page_text3"
android:textColor="@color/White"
android:justificationMode="inter_word"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
app:srcCompat="@drawable/ic_local_phone_black_24dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mobile_number"
android:textColor="@color/White"
android:textSize="16sp"
android:paddingLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rating"
android:textSize="16sp"
android:textColor="@color/White"
android:paddingLeft="120dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_star_black_24dp"
android:paddingLeft="10dp"/>
</LinearLayout>
<FrameLayout
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="300dp"
android:layout_height="100dp"
android:background="@drawable/detail_pager_button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:text="Entry Via GuestList"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:textSize="17sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="14sp"
android:text="@string/dummy_text"
android:layout_marginTop="40dp"
android:layout_marginLeft="10dp"/>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
app:srcCompat="@drawable/ic_keyboard_arrow_right_black_24dp"
android:layout_marginLeft="250dp"
android:layout_marginTop="20dp"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="0dp"
android:layout_weight="8"
android:layout_height="wrap_content"
android:text="@string/event_list_text"
android:layout_marginLeft="15dp"
android:textSize="25sp"
android:textColor="@color/White"/>
<ImageView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_marginLeft="180dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/more_button"/>
</LinearLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:id="@+id/llDateContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:showDividers="middle">
</LinearLayout>
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:id="@+id/llTimeContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:showDividers="middle">
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="0dp"
android:layout_weight="8"
android:layout_height="wrap_content"
android:text="@string/choose_table_text"
android:layout_marginLeft="15dp"
android:textSize="25sp"
android:textColor="@color/White"/>
<ImageView
android:layout_width="0dp"
android:layout_weight="2"
android:visibility="gone"
android:layout_marginLeft="180dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/more_button"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_marginTop="20dp"
android:id="@+id/event_list_recyclerview"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="0dp"
android:layout_weight="8"
android:layout_height="wrap_content"
android:text="@string/persons_list_text"
android:layout_marginLeft="15dp"
android:textSize="25sp"
android:textColor="@color/White"/>
<ImageView
android:layout_width="0dp"
android:layout_weight="2"
android:visibility="gone"
android:layout_marginLeft="180dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/more_button"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/person_list_recyclerview"
android:layout_width="wrap_content"
android:layout_marginTop="10dp"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/venue_detail"
android:textSize="25sp"
android:layout_marginLeft="10dp"
android:textColor="@color/White"
android:layout_marginTop="10dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/clock_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/clock_1"
android:scaleType="centerCrop"
android:paddingStart="10dp"
/>
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="@+id/opening_hours_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/opening_hours_text"
android:textColor="@color/White"
android:textSize="18sp"
android:paddingTop="5dp"
android:paddingStart="15dp"
android:paddingEnd="15dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
android:src="@drawable/ic_share_black_24dp"
app:layout_anchor="@id/detail_page_viewpager"
app:layout_anchorGravity="bottom|right|end"/>
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
【问题讨论】:
标签: android android-scrollview floating-action-button