我想为上下文操作栏设置标题(如下图所示).

我尝试过以下方法:
getActionBar().setTitle("Title for cab");
Run Code Online (Sandbox Code Playgroud)
但标题没有出现.
我正在我的应用中实施应用内结算以解锁高级功能.应用内结算功能设置正确.除了"开发者有效载荷"之外,一切似乎都很好.
示例应用程序说
/*
* TODO: verify that the developer payload of the purchase is correct. It will be
* the same one that you sent when initiating the purchase.
*
* WARNING: Locally generating a random string when starting a purchase and
* verifying it here might seem like a good approach, but this will fail in the
* case where the user purchases an item on one device and then uses your app on
* a different device, because …Run Code Online (Sandbox Code Playgroud) 我正在使用启动屏幕的DayNight主题.
启动屏幕是具有白色背景的图层列表.
因此,当白昼,白色发射屏幕显示白色活动.但到了晚上,白色发射屏幕显示出黑暗活动.
如何根据主题更改启动屏幕中的背景颜色.
无法使用自定义颜色attrs,因为只有DayNight主题.
的themes.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorControlNormal">@color/colorAccent</item>
</style>
<style name="LaunchTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>
Run Code Online (Sandbox Code Playgroud)
launch_screen.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@color/material_white"/>
</item>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/launch_logo"
android:tileMode="disabled"/>
</item>
Run Code Online (Sandbox Code Playgroud)
android material-design android-toolbar android-appbarlayout material-you
我正在Android项目中使用ChristopheVersieux的HoloEverywhere库.
除了对话框,一切都很好.Holo样式不适用于AlertDialogs和自定义对话框.
我在我的应用程序中使用对话框的自定义主题。自定义主题适用于警报对话框。但该主题不适用于 ListPreference、CheckboxPreference 等首选项对话框。
目前我正在使用MaterialAlertDialogTheme属性应用对话框主题,如下所示:
主要应用主题:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:navigationBarColor">?attr/colorPrimary</item>
<item name="android:windowTranslucentStatus">true</item>
<!-- Material Dialog theme -->
<item name="materialAlertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog</item>
</style>
Run Code Online (Sandbox Code Playgroud)
材质对话框样式:
<!-- Styles for Material Dialogs -->
<style name="ThemeOverlay.App.MaterialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="colorSurface">@android:color/white</item>
<item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
<item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialog.App.Title.Text</item>
<item name="buttonBarPositiveButtonStyle">@style/Widget.App.PositiveButton</item>
</style>
<style name="MaterialAlertDialog.App" parent="MaterialAlertDialog.MaterialComponents">
<item name="shapeAppearance">@style/ShapeAppearance.App.MediumComponent</item>
</style>
<style name="MaterialAlertDialog.App.Title.Text" parent="MaterialAlertDialog.MaterialComponents.Title.Text">
<item name="android:textStyle">bold</item>
</style>
<style name="Widget.App.PositiveButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Button</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.SmallComponent</item>
<item name="android:textAllCaps">false</item>
</style>
<style name="ThemeOverlay.App.Button" parent="">
<item name="colorPrimary">@android:color/black</item>
</style>
<style name="ShapeAppearance.App.MediumComponent" parent="ShapeAppearance.MaterialComponents.MediumComponent">
<item name="cornerFamily">rounded</item>
<item …Run Code Online (Sandbox Code Playgroud) RecyclerView 文档提到了一个公共方法 - getBindingAdapterPosition。 https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapterPosition()
但我似乎无法找到它。
我错过了什么?
在我的应用程序中,我想要如下图所示的布局.

我已经尝试了几个小时,但无法获得理想的结果.
这是我的布局xml:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<View
android:id="@+id/middleSeperator"
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:background="#90909090" />
<LinearLayout
android:id="@+id/leftLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@id/middleSeperator"
android:gravity="right"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/batt_health"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/batt_level"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/batt_status"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/batt_tech"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/batt_temp"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/batt_voltage"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:id="@+id/rightLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/middleSeperator" …Run Code Online (Sandbox Code Playgroud)