gpt4 book ai didi

java - BottomAppBar backgrounTint 与父项不正确匹配并显示在屏幕的一半中

转载 作者:太空宇宙 更新时间:2023-11-04 09:26:33 27 4
gpt4 key购买 nike

我尝试了我的布局代码,BottomAppBar 没有完美显示,我到处搜索,但没有发现任何问题。

enter image description here我在 Android Studio 3.4 上尝试过这个,我的 gradle 依赖项是

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.google.android.material:material:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
implementation 'androidx.vectordrawable:vectordrawable:1.0.0-beta01'
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'

}

我在 home_bottomappbar.xml 中使用的代码

<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottom_app_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:backgroundTint="@color/colorPrimaryDark"
app:fabAlignmentMode="center"
app:fabAttached="true"
app:fabCradleDiameter="0dp"
app:fabCradleVerticalOffset="10dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/bottom_app_bar"
app:backgroundTint="@color/colorPrimary"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

最佳答案

Coordinator 布局替换为 RelativeLiner 布局。它会工作得很好。

关于java - BottomAppBar backgrounTint 与父项不正确匹配并显示在屏幕的一半中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57635843/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com