android-design-library 相关问题

Design包提供API以支持向您的应用添加材料设计组件和模式。

将数据插入房间数据库

在 RoomDB 上插入数据时,处理策略冲突的最佳方法是什么? 正如我所尝试的那样。 @Insert(onConflict = @Insert(onConflict = OnConflictStrategy.REPLACE)) 但我...

回答 1 投票 0

Android 折叠工具栏有太多填充

我有一个折叠工具栏设置如下: 我有一个折叠工具栏,如下所示: <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:collapsedTitleGravity="right" app:paddingStart="5dp" app:titleEnabled="true" app:expandedTitleGravity="top|center_horizontal" app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" app:expandedTitleMarginEnd="0dp" app:expandedTitleMarginStart="0dp" app:expandedTitleMarginTop="0dp"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:scaleType="centerCrop" app:layout_collapseMode="parallax"/> <com.ashojash.android.customview.VenueScoreIndicator android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:id="@+id/venueScoreIndicator"/> </RelativeLayout> <!-- As our statusBar is transparent below and content is moved behind our toolbar has to include the padding on top so we use this area --> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:paddingRight="8dp" app:layout_collapseMode="pin" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> 正如您所看到的,折叠标题的顶部和底部有一些额外的填充,我没有看到任何将 app:collapsedTitlePaddingTop 设置为 0dp 的选项。 我错过了什么? 删除所有边距 只需使用 app:expandedTitleMargin="@dimen/your_dimen_value" 我认为问题在于 RelativeLayout 和 match_parent 高度。尝试删除它,如果问题解决了,请以某种方式编写没有match_parent高度的布局 请尝试一下......这会有帮助 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll|enterAlways|snap" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> <android.support.design.widget.TabLayout android:id="@+id/tabLayout" android:layout_width="match_parent" android:layout_height="wrap_content" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/viewPager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout>

回答 3 投票 0

为什么我收到错误“未解析的引用:fillMaxSize”,修饰符 = Modifier.fillMaxSize?

我正在尝试使用jetpack compose,但它给出了很多错误,其中之一是 - com.example.imagecardcompose 包 导入 android.os.Bundle 导入 androidx.activity.ComponentActivity ...

回答 1 投票 0

在 Jetpack Compose 中自定义 Material 3 的 Switch 组件

Switch 示例 有没有办法自定义 Material 3 的 Switch 外观和行为? 我在 Now in Android Case Study Figma 文件中看到了一些定制组件的示例,我想知道是否...

回答 1 投票 0

Android 多行 Snackbar

我正在尝试利用Android设计支持库中的新Snackbar来显示多行snackbar,如http://www.google.com/design/spec/components/snackbars-toasts.html#snackbars-toasts-所示

回答 20 投票 0

材料搜索和材料选项卡冲突库

我正在尝试在 android studio 项目的不同布局中实现材质搜索栏和材质选项卡,但是当我使用任何 'com.google.a... 时,TabLayout 和 TabItems 出现渲染错误

回答 0 投票 0

TabLayout 和 ViewHolder 的渲染问题

我目前无法仅使用 TabLayout 和 ViewPager 呈现活动。我收到此错误: 样式 ResourceReference{namespace=apk/res-auto, type=attr, name=textAppearanceButton} 是没有...

回答 2 投票 0

如何将滚动视图更改为可滚动约束布局或如何使用滚动视图

我想添加更多选项,如添加产品等,但我不能,因为滚动视图无法正常工作。以下是我的设计代码: 我想添加更多选项,如添加产品等,但我不能,因为滚动视图无法正常工作。以下是我的设计代码: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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" tools:context=".home"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/scrollView3" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/view6"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/linearLayout" android:layout_width="0dp" android:layout_height="0dp" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.498" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" > <View android:id="@+id/view8" android:layout_width="0dp" android:layout_height="100dp" android:layout_marginStart="30dp" android:layout_marginTop="20dp" android:layout_marginEnd="30dp" android:background="@drawable/options_bg" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/imageView4" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginStart="30dp" app:layout_constraintBottom_toBottomOf="@+id/view8" app:layout_constraintStart_toStartOf="@+id/view8" app:layout_constraintTop_toTopOf="@+id/view8" app:srcCompat="@drawable/box" /> <TextView android:id="@+id/textView4" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="30dp" android:fontFamily="@font/abel" android:text="Products" android:textSize="34sp" app:layout_constraintBottom_toBottomOf="@+id/view8" app:layout_constraintEnd_toEndOf="@+id/view8" app:layout_constraintStart_toEndOf="@+id/imageView4" app:layout_constraintTop_toTopOf="@+id/view8" /> <View android:id="@+id/view10" android:layout_width="0dp" android:layout_height="100dp" android:layout_marginStart="30dp" android:layout_marginTop="20dp" android:layout_marginEnd="30dp" android:background="@drawable/options_bg" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/view8" /> <ImageView android:id="@+id/imageView5" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginStart="30dp" app:layout_constraintBottom_toBottomOf="@+id/view10" app:layout_constraintStart_toStartOf="@+id/view10" app:layout_constraintTop_toTopOf="@+id/view10" app:srcCompat="@drawable/distribution" /> <TextView android:id="@+id/textView5" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="30dp" android:fontFamily="@font/abel" android:text="Distributor" android:textSize="34sp" app:layout_constraintBottom_toBottomOf="@+id/view10" app:layout_constraintEnd_toEndOf="@+id/view10" app:layout_constraintStart_toEndOf="@+id/imageView5" app:layout_constraintTop_toTopOf="@+id/view10" /> <View android:id="@+id/view11" android:layout_width="0dp" android:layout_height="100dp" android:layout_marginStart="30dp" android:layout_marginTop="20dp" android:layout_marginEnd="30dp" android:background="@drawable/options_bg" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/view10" /> <ImageView android:id="@+id/imageView6" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginStart="30dp" app:layout_constraintBottom_toBottomOf="@+id/view11" app:layout_constraintStart_toStartOf="@+id/view11" app:layout_constraintTop_toTopOf="@+id/view11" app:layout_constraintVertical_bias="0.38" app:srcCompat="@drawable/cargo" /> <TextView android:id="@+id/textView6" android:layout_width="0dp" android:layout_height="38dp" android:layout_marginStart="30dp" android:fontFamily="@font/abel" android:text="Orders" android:textSize="34sp" app:layout_constraintBottom_toBottomOf="@+id/view11" app:layout_constraintEnd_toEndOf="@+id/view11" app:layout_constraintStart_toEndOf="@+id/imageView6" app:layout_constraintTop_toTopOf="@+id/view11" /> <Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="logout" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/view11" /> <ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="invisible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> <View android:id="@+id/view6" android:layout_width="0dp" android:layout_height="170dp" android:background="@drawable/bottom_radius" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <View android:id="@+id/settings" android:layout_width="30dp" android:layout_height="30dp" android:layout_marginTop="10dp" android:layout_marginEnd="10dp" android:background="@drawable/settings_ico" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="30dp" android:layout_marginTop="20dp" android:fontFamily="@font/abel" android:text="Hello!" android:textSize="40sp" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/usertopname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="30dp" android:layout_marginTop="10dp" android:fontFamily="@font/abel" android:text="Lakshmanan" android:textSize="24sp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView" /> <TextView android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="31dp" android:fontFamily="@font/abel" android:text="Youre not verified" android:textColor="#FF0000" android:textSize="24sp" android:visibility="invisible" app:layout_constraintBottom_toBottomOf="@+id/view6" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/usertopname" /> </androidx.constraintlayout.widget.ConstraintLayout> 此处为示例截图 请将其更新为可滚动选项。以为我可以将滚动视图转换为约束,它会起作用,而且设计起来会更容易。但它不能正常工作

回答 0 投票 0

如何从屏幕的任何地方拖动底层表?

我正试图实现像youtube一样的体验,并允许用户从屏幕的任何地方拖动底部表。我尝试了许多解决方案,但都无济于事。

回答 1 投票 0

约束布局设置运行时 constraintStart_toEndOf

我有一个约束app:layout_constraintStart_toStartOf="parent"。运行时我需要把这个约束改为app:layout_constraintStart_toEndOf="@+id\myid"。从我的研究中,我只发现...

回答 1 投票 0

多次调用setupWithViewPager会导致内存泄漏吗?

我希望使用Firebase查询填充TabLayout(来自设计库)。我已经设置了一个(状态)寻呼机适配器,该适配器可以正确处理动态添加和删除页面(Firebase ...

回答 1 投票 1

如何在Android应用中实现设计库?

我不会在我的项目中实现此设计库> https://developer.android.com/topic/libraries/support-library/packages.html#design(com.android.support:design:28.0.0)。但是,当我同步时,...

回答 1 投票 0

为什么我无法在android 10中打开文件选择器并显示Toast未能创建图像文件

我无法在android 10中打开文件选择器,并显示吐司无法创建图像文件...但是在android 9中工作正常。] >>

回答 1 投票 0

隐藏键盘不会重新展开布局

我实现了带有AppBarLayout和Toolbar的CoordinatorLayout,以在滚动和一切正常工作时隐藏工具栏。当我实现搜索视图时出现问题。这是我的activity_main ...

回答 2 投票 1


什么是CoordinatorLayout?

仅查看了新的Android支持设计库的演示应用程序。它由Chris Banes在github上提供。在整个应用程序中,大量使用了CoordinatorLayout。此外,许多支持设计...

回答 6 投票 89

我需要建议如何在android中实现这种UI?

希望您一切都好。我需要您的支持,如果您对此有所了解,请告诉我。我想设计这样的seekbar我想设计这样的seekbar。请帮帮我!!

回答 1 投票 0

BottomNavigationView +导航到不同选项卡时保存片段状态

我正在使用BottomNavigationView作为底部的标签。 1)标签1-从服务器获取数据并显示到RecyclerView 2)标签2-从服务器获取URL并加载Webview 3)标签3-从...

回答 1 投票 0

使用Android设计库时需要消除视差效果中的弹性行为

我正在使用android设计支持库来实现视差效果,底部具有回收器视图。当我下拉时,动画具有我不想要的弹性行为。我想要平滑的动画用于向上和向下滚动。 ...

回答 0 投票 1

Android设计支持库导航视图自定义

关于新的导航视图,我有几个问题。 1)滚动导航视图将滚动整个视图,但我只希望标题保留在该位置,并且导航项要滚动。 ...

回答 2 投票 3

© www.soinside.com 2019 - 2024. All rights reserved.