我的android.support.v7.widgetAndroid应用中有一个工具栏.它的背景颜色是亮橙色,最好看的颜色是白色而不是黑色.
我的默认颜色是黑色而不是白色.由于它会与其他东西冲突,这几乎是不可能的.我无法将主要文本颜色更改为白色!
我设法改变了标题颜色. 我现在正在寻找的是如何改变动作按钮颜色(白色).
我的代码:
主要活动:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".UI.activities.MainActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/r2_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:titleTextColor="@color/primary_text_material_light"
app:subtitleTextColor="@color/primary_text_material_light"
android:theme="@style/R2Theme.Toolbar"/>
<fragment android:name="com.r2retail.r2retailapp.UI.fragments.SetupFragment"
android:layout_below="@+id/r2_toolbar"
android:id="@+id/list"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
菜单栏:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/about"
android:icon="@drawable/ic_menu"
android:title="About"
app:showAsAction="never"/>
</menu>
Run Code Online (Sandbox Code Playgroud)
样式:
<resources>
<style name="R2Theme" parent="Theme.AppCompat.Light.NoActionBar">=
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:textColorPrimary">@color/secondary_text_material_dark</item>
<item name="android:textColorSecondaryInverse">@color/primary_text_material_light</item>
</style>
<style name="R2Theme.Toolbar" parent="R2Theme">
<item name="actionMenuTextColor">@color/primary_text_material_light</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud) 我有一个问题,我需要将两个非常大的结构(生成的 protobuf)相互比较,作为测试用例的一部分。这些结构体中有多个嵌套数组。下面是一个重现/演示该问题的简化示例。
package pkg
import (
"github.com/stretchr/testify/assert"
"reflect"
"testing"
)
type structOne struct {
Foo string
Offs []*structTwo
}
type structTwo struct {
Identifier string
}
func Test_Compare(t *testing.T) {
exp := &structOne{
Foo: "bar",
Offs: []*structTwo{
{
Identifier: "one",
},
{
Identifier: "two",
},
{
Identifier: "three",
},
{
Identifier: "four",
},
},
}
act := &structOne{
Foo: "bar",
Offs: []*structTwo{
{
Identifier: "four",
},
{
Identifier: "three",
},
{
Identifier: "two",
},
{
Identifier: "one",
},
},
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个用于定义配置类的抽象类.我希望随时从JSON导出和导入这些类.我正在尝试使用Gson实现这一目标.
写入JSON时我收到错误:
无法序列化java.lang.Class - 忘记注册类型适配器?
我的主要课程:https://hastebin.com/pogohodovi.scala
摘要配置类:https://hastebin.com/adeyawubuy.cs
子类的示例:
public class DyescapeCOREConfiguration extends DyescapeConfiguration {
private static transient DyescapeCOREConfiguration i = new DyescapeCOREConfiguration();
public static DyescapeCOREConfiguration get() { return i; }
@Expose public static String ServerID = UUID.randomUUID().toString();
}
Run Code Online (Sandbox Code Playgroud)
请注意:我需要将子配置类中的变量保持为静态.我试图创建一些适配器/序列化器,但它们似乎不起作用.