在屏幕布局内部,我正在尝试使用带有圆角的新材质组件实现 MaterialButton
<android.support.design.button.MaterialButton
android:text="@string/login"
android:id="@+id/btnEntrance"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="104dp"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_height="40dp"
app:cornerRadius="8dp"/>
Run Code Online (Sandbox Code Playgroud)
但在预览屏幕上,圆角不可见 - 此属性不会对视图带来任何影响。有人能解释一下为什么吗?
我想从Studio的SDK Manager更新我的Android API SDK 28.在"SDK平台"选项卡中,我可以检查除第一个Android API 28之外的每个Android API.任何人都能解释一下为什么会发生这种情况吗?
我正在编写一个 Android 应用程序,它基于 Fragments,插入根 emty 活动中。对于每个片段,我配置了单独的工具栏。当我打开第一个屏幕片段时,它工作正常。此屏幕的xml、工具栏代码和屏幕截图
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/layout_toolbar_main"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/listOfClientsWithActions"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:clipToPadding="false" android:paddingTop="8dp"/>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:src="@drawable/ic_baseline_add_white_24"
android:layout_margin="16dp" app:fabSize="normal"/>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:itemIconTint="@color/drawer_item"
app:menu="@menu/drawer_menu"
app:itemTextAppearance="@style/NavDrawerItem"
app:headerLayout="@layout/nav_header"/>
</android.support.v4.widget.DrawerLayout>
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initToolbar(view)
}
private fun initToolbar(view: View) {
val toolbar = view.findViewById<Toolbar>(R.id.toolbar_main)
(activity …Run Code Online (Sandbox Code Playgroud) android android-linearlayout android-fragments android-scrollview android-actionbar