AppBarLayout
の後、RecyclerView
の前に、余分な空白が来ています。どのように来るのか分かりません。アンドロイドの余分な空白Views
私はマージンをチェックしましたが、すべて正常です。
また、同じ理由で、私はRecyclerViewの最後の要素がレイアウトビューから切り取られたと考えています。
助けてください。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/transMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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="80dp"
android:fitsSystemWindows="true"
android:paddingLeft="12dp"
app:contentScrim="?android:attr/colorPrimary"
app:layout_scrollFlags="exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbarAct"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:layout_scrollFlags="scroll">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!--button was here-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/monthSelLay"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/monthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginTop="12dp"
android:layout_toRightOf="@id/monthButton"
android:src="@drawable/ic_keyboard_arrow_down_black_24dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/syncLay"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/syncButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="8dp"
android:text="SyncUp"
android:textAlignment="center"
android:textColor="#000" />
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@+id/syncButton"
android:src="@drawable/ic_cached_black_48dp" />
</RelativeLayout>
</LinearLayout>
<!--switch was here-->
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.v7.widget.SearchView
android:id="@+id/searchTrans"
android:layout_width="350dp"
android:layout_height="40dp"
android:layout_below="@+id/toolbar"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#fff"
android:hint="Start typing an Amount/Description"
android:textColor="#000"
android:textColorHint="#ccc"
app:tabMode="scrollable" />
<!--need to change the background as an object oval prbbly-->
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/trans"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add_black_24dp"
app:backgroundTint="@color/colorAccent"
app:elevation="6dp"
app:pressedTranslationZ="12dp" />
</FrameLayout>
最初の画像では、空白を表示するために少し上にスクロールしました。 RecyclerView
のトリミング最後の要素で
このタイプの質問は既に尋ねられています:http://stackoverflow.com/questions/37209342/coordinatorlayout-adds-space-between-appbarlayout-and-recyclerview。 –
Mayura、ありがとう! – user3820753