Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android andoidx库中的浮动操作按钮_Android_Floating Action Button_Androidx - Fatal编程技术网

Android andoidx库中的浮动操作按钮

Android andoidx库中的浮动操作按钮,android,floating-action-button,androidx,Android,Floating Action Button,Androidx,大家好,有人知道如何在androidx库中使用浮动操作按钮吗?我想,在androidx库中,他们会取代它 implementation 'com.android.support:appcompat-v7:xx.xx.xx' 借 但这对任何建议都没有帮助?在andoidx库中使用浮动操作按钮使用下面的依赖项 implementation 'com.google.android.material:material:1.0.0-rc01' 有关更多信息,请查看 完整示例 XML代码 要在andro

大家好,有人知道如何在androidx库中使用浮动操作按钮吗?我想,在androidx库中,他们会取代它

implementation 'com.android.support:appcompat-v7:xx.xx.xx'


但这对任何建议都没有帮助?

在andoidx库中使用浮动操作按钮使用下面的
依赖项

implementation 'com.google.android.material:material:1.0.0-rc01'
有关更多信息,请查看

完整示例 XML代码


要在androidx库中使用浮动操作按钮,请使用此实现

implementation 'com.google.android.material:material:1.0.0'

现在,您可以迁移到Android x并将xml替换为:

<com.google.android.material.floatingactionbutton.FloatingActionButton ... />

导入com.google.android.material.floatingactionbutton.floatingactionbutton但如何让按钮显示在右下角,而不是左上角,就像这段代码一样?@RichardBarraclough没有理解你?我尝试了上面的代码,按钮出现了,但是它在屏幕的左上角。@RichardBarraclough您的按钮出现在屏幕的左上角,因为我已经添加了
app:layout\u constraintBottom\u toBottomOf
app:layout\u constraintentend\u toEndOf
app:layout\u constraints start\u toStartOf
app:layout\u constraintop\u topof
只需从代码中删除此项,并根据需要应用约束即可
import com.google.android.material.floatingactionbutton.FloatingActionButton
implementation 'com.google.android.material:material:1.0.0'
<com.google.android.material.floatingactionbutton.FloatingActionButton ... />
implementation 'com.google.android.material:material:1.0.0'