2017-06-23 67 views
0

我已经添加recyclerview以及浮动动作按钮,但是当我旋转屏幕在移动浮动按钮是不可见的只有recyclerview是visibleHow使它visible.My代码是如下:浮动动作按钮不显示在屏幕的旋转

<?xml version="1.0" encoding="utf-8"?> 
 
<android.support.design.widget.CoordinatorLayout 
 
    xmlns:android="http://schemas.android.com/apk/res/android" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="match_parent" 
 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
 
    android:orientation="vertical" 
 
    android:background="#DCDCDC"> 
 

 
    <android.support.v7.widget.RecyclerView 
 
     android:id="@+id/CustomerList" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="wrap_content" 
 
     android:paddingTop="10dp" 
 
     android:layout_weight="1" 
 
     android:layout_marginLeft="20dp" 
 
     android:layout_marginStart="20dp" 
 
     android:layout_marginBottom="20dp" 
 
     android:layout_marginRight="20dp" 
 
     android:layout_marginEnd="20dp" 
 
     android:layout_marginTop="20dp" 
 
     android:background="#FFF" 
 
     /> 
 
    <android.support.design.widget.FloatingActionButton 
 
     android:layout_height="wrap_content" 
 
     android:layout_width="wrap_content" 
 
     android:id="@+id/nextToThird" 
 
     app:backgroundTint="@color/colorgreen" 
 
     android:src="@drawable/right" 
 
     android:layout_marginStart="260dp" 
 
     android:layout_marginLeft="260dp" 
 
     android:layout_marginTop="450dp" 
 
     android:padding="0dp"/> 
 
    
 
</android.support.design.widget.CoordinatorLayout>

+0

检查我,问我的情况下,任何的查询 –

回答

0

使用相对布局会在这两个方向横向和纵向 像这样工作

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_main" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.ncrypted.fontdemo.MainActivity"> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/CustomerList" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:background="#FFF" /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/nextToThird" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_margin="20dp" /> 
</RelativeLayout> 

问我任何查询的情况下

+0

由于它的工作现在.. – Aiyappa

+0

@Aiyappa请接受我答 –