Java 为什么我的浮动操作按钮看起来像屏幕上的一个小点
我的主要活动上有一个浮动操作按钮,在Pixel 4XL模拟器上看起来不错,但当我把它放在我的华为P30 pro上时,它看起来像我屏幕上的一个小点。为什么? XML:Java 为什么我的浮动操作按钮看起来像屏幕上的一个小点,java,android,android-studio,Java,Android,Android Studio,我的主要活动上有一个浮动操作按钮,在Pixel 4XL模拟器上看起来不错,但当我把它放在我的华为P30 pro上时,它看起来像我屏幕上的一个小点。为什么? XML: 尝试设置宽度和高度以包装内容,并使用app:fabSize属性设置浮动操作按钮的大小,此属性接受普通、小等。尝试此操作(我将按钮水平居中,并删除开始/结束边距和对齐): 谢谢,这工作做得很好 <?xml version="1.0" encoding="utf-8"?&g
尝试设置宽度和高度以包装内容,并使用app:fabSize
属性设置浮动操作按钮的大小,此属性接受普通、小等。尝试此操作(我将按钮水平居中,并删除开始/结束边距和对齐):
谢谢,这工作做得很好
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="#17171A">
<TextView
android:id="@+id/tasksText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@android:color/white"
android:layout_marginStart="16dp"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:textSize="32sp"
android:text="Oversikt" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tasksRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tasksText"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:nestedScrollingEnabled="true"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="69dp"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="179dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="178dp"
android:layout_marginBottom="48dp"
android:contentDescription="@string/todo"
android:src="@drawable/ic_baseline_add_24"
android:text="Legg Til"
app:backgroundTint="#3068DF" />
</RelativeLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="69dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="32dp"
android:layout_marginBottom="48dp"
android:contentDescription="@string/todo"
android:src="@drawable/ic_baseline_add_24"
android:text="Legg Til"
app:backgroundTint="#3068DF" />