0

해피 뉴 년. 내 코드보기에서 floatingActionButton을 설정했지만 디자인보기에 단추가 표시되지 않습니다. 여기서 문제가되는 것 같고 어떻게 해결할 수 있습니까?코드 뷰에서 디자인을 설정 한 후 디자인 뷰에 FloatingActionButton이 표시되지 않습니다.

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
} 


<?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:layout_width="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_height="match_parent" 
    tools:context=".MainActivity"> 

<android.support.design.widget.CoordinatorLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


    <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" 
     app:layout_anchor="@id/viewOne" 
     app:layout_anchorGravity="bottom|right|end" 
     app:rippleColor="#FFFFff" /> 

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

</RelativeLayout> 
+0

'app : layout_anchor = "@ id/viewOne"을 제거하여 문제를 해결할 수 있습니다. –

+0

코드에 문제가 있다고 말하면 해당 코드를 추가해야합니다. !!!! ! –

답변

0

은 ..이 내가 선형 레이아웃으로 cordinatorLayout을 교체 할 때이 디자인 뷰에서 보여준 매력

<android.support.design.widget.FloatingActionButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/fabCreateGroup" 
    app:fabSize="normal" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" 
    android:layout_margin="15dp" 
    android:scaleType="center" 
    android:src="@drawable/youricon" 
    app:backgroundTint="@color/colorPrimary" /> 
+0

디자인보기에서 cordinatorLayout을 선형 레이아웃으로 바꿨을 때 앱을 실행할 수있었습니다. 이 코드는 코디네이터 레이아웃 아래에있을 때만 작동합니다. 더 이상 대답이 있습니까? – Nono

0

처럼 작동합니다이 코드를 작성하지만 응용 프로그램을 실행할 수 있습니다. 이 코드는 코디네이터 레이아웃 아래에있을 때만 작동합니다. 더 이상 대답이 있습니까?