我想将扩展浮动操作按钮中的文本居中对齐,但我无法做到这一点。正如您在下图中看到的,文本没有居中对齐。
这是扩展浮动操作按钮的代码:
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/compress_start_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="S"
app:backgroundTint="?android:colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textColor="@color/textColorPrimaryDark"
app:layout_constraintStart_toStartOf="parent"
android:textAlignment="center"
/>
Run Code Online (Sandbox Code Playgroud)
我做错了什么吗?任何帮助将不胜感激。
android android-layout floating-action-button material-ui material-components-android
基本上,我正在从用户存储中读取图像进行处理,在读取图像时,我正在计算 inSampleSize 以节省一些内存,这是我的代码:
fun calculateInSampleSize(
options: BitmapFactory.Options,
reqWidth: Int,
reqHeight: Int
): Int {
// Raw height and width of image
val (height: Int, width: Int) = options.run { outHeight to outWidth }
var inSampleSize = 1
if (height > reqHeight || width > reqWidth) {
val halfHeight: Int = height / 2
val halfWidth: Int = width / 2
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger …Run Code Online (Sandbox Code Playgroud)