2017-12-18 13 views
4

私はそうのように、ConstraintLayout内部FloatingActionButtonを持っている:私はAndroidのデータバインディング(Kotlinクラス上)とFragment上のレイアウトを膨らませるよう、しかしFloatingActionButton上の右と下の制約は、それが見えない可能

<android.support.constraint.ConstraintLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <android.support.design.widget.FloatingActionButton 
       android:id="@+id/fab_add_topic" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       app:srcCompat="@drawable/ic_add" 
       app:layout_constraintRight_toLeftOf="parent" 
       app:layout_constraintBottom_toTopOf="parent" 
       android:foregroundGravity="right|bottom" 
       android:layout_marginRight="@dimen/material_tooltip_margin_top" 
       android:layout_marginBottom="@dimen/material_tooltip_margin_top" 
       android:elevation="6dp" 
       app:pressedTranslationZ="12dp" 
       app:borderWidth="0dp"/> 

</android.support.constraint.ConstraintLayout> 

、現れません。

私はまだConstraintLayoutの内側に、ここで言及したソリューションを実装しようとした:Bottom Align Floating Action Button

私はトップと左制約とそれを表示する場合、それがうまく表示されます。

私が逃したものは何ですか?ありがとう!

答えて

5

あなたのレイアウトは、これら2つの制約があります。これは、機能、画面の左上隅にあなたのFABの右下隅に配置します

app:layout_constraintRight_toLeftOf="parent" 
app:layout_constraintBottom_toTopOf="parent" 

。言い換えれば、FABを画面外にするように制約しました。

チャンスはあなたがFABの権利は、画面の右になりたいものであることに優れている、とFABの下には、画面の一番下であることを。代わりにこれらを使用してください:

app:layout_constraintRight_toRightOf="parent" 
app:layout_constraintBottom_toBottomOf="parent" 
+0

FABまたは親ConstraintLayoutに追加の属性を設定しましたか?残念なことに、制約だけを置き換えることはできません。 –

+0

私は、境界線が画面外にあるViewPagerに問題がありました。誰かがまだいなければ私は別の質問を投稿します。ありがとう@ベンP. –

関連する問題