我刚刚将新的TabLayout组件添加到我的应用程序中.正如你可能知道有针对标签两种不同的模式app:tabMode="scrollable"和app:tabMode="fixed".
当我使用时,app:tabMode="fixed"我得到以下结果:
左侧和右侧没有边距/填充,但文本被包裹.
但是当我使用时,app:tabMode="scrollable"我得到以下结果:
文字没有被包裹,但这里是一个奇怪的边缘,我无法摆脱它.
我也试过tabGravity设置要么app:tabGravity="center"或app:tabGravity="fill"但未取得任何变化.
如果你们这些聪明的家伙和女孩能为我找到解决方案,那就太好了.
干杯,卢卡斯
我正在尝试使用自定义布局在 Android 7 上创建通知,但我想使用 v7 支持库中的 DecoratedCustomView 样式:https : //developer.android.com/reference/android/support/v7/app/ NotificationCompat.DecoratedCustomViewStyle.html
我想使用这种风格的原因是我想使用android提供的通知头,如文档所述:
与提供完全自定义的通知不同,开发人员可以设置此样式并仍然获得系统装饰,例如带有扩展功能和操作的通知标题。
因此,我尝试使用仅包含带有单个 TextView 的 LinearLayout 的 RemoteViews。
final NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
.setWhen(new Date().getTimeInMillis())
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle("title")
.setContentText("text")
.setStyle(new android.support.v7.app.NotificationCompat.DecoratedCustomViewStyle())
.setContent(remoteViews);
Run Code Online (Sandbox Code Playgroud)
结果是一个只包含我的 RemoteViews 的通知,不幸的是没有标题。我刚刚在媒体上找到了一个使用此示例的示例:https : //medium.com/@britt.barak/notifications-part-3-going-custom-31c31609f314
但我无法使用 Android 提供的标头。任何帮助,将不胜感激 :)
android android-appcompat android-notifications android-7.0-nougat