我在ICS应用程序中使用带有holo.light主题的标准Switch控件.
我想将切换按钮的突出显示或状态颜色从标准浅蓝色更改为绿色.
这应该很容易,但我似乎无法弄清楚如何做到这一点.
我尝试使用以下链接更改SwitchCompat的颜色:
注意我的开关中的低对比度:

但在更改所有相关颜色值后,SwitchCompat的轨道(亮灰色)保持不变.除了颜色,我不想改变外观.拇指是粉红色的,我希望轨道有一些对比.我错过了在styles.xml中定义一个值吗?
我尝试了这些值(随机非白色):
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/first</item>
<item name="colorPrimaryDark">@color/second</item>
<item name="colorAccent">@color/third</item>
...
<item name="colorControlActivated">@color/first</item>
<item name="colorControlHighlight">@color/first</item>
<item name="colorControlNormal">@color/second</item>
<item name="colorSwitchThumbNormal">@color/second</item>
<item name="colorButtonNormal">@color/second</item>
...>
Run Code Online (Sandbox Code Playgroud) 我想为我的应用程序设置Lollipop样式开关按钮:

我怎么能实现这个按钮所以在旧版本的android上看起来也是如此?
这是我的应用主题:
<style name="BaseTheme" parent="Theme.AppCompat.Light">
...
<item name="colorControlActivated">@color/default_orange</item>
...
</style>
...
<style name="Switch" parent="Material.Widget.Switch">
<item name="colorControlActivated">@color/default_green</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如果我使用Switch风格:
<com.rey.material.widget.Switch
style="@style/Switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"/>
Run Code Online (Sandbox Code Playgroud)
在colorControlActivated使用它的里面的一个BaseTheme(橙色),而不是开关一个(绿色).
为什么会这样?colorControlActivated对于不同的观点我不能有不同的看法吗?
谢谢.
android android-appcompat android-styles android-5.0-lollipop
我正在使用android设计库的TextinputLayout.但是无法在TextinputLayout中自定义EditText的下划线颜色.请帮忙.
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_pincode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/input_layout_city"
android:layout_marginTop="@dimen/_10sdp"
android:textColorHint="#000000"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<EditText
android:id="@+id/input_pincode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pincode*"
android:textSize="@dimen/_13sdp" />
</android.support.design.widget.TextInputLayout>
<style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/_13sdp</item>
<item name="colorControlNormal">@color/black</item>
</style>
Run Code Online (Sandbox Code Playgroud) 我需要更改SwitchCompat的轨道颜色.我试过这个,但它对我不起作用.这是我的XML文件的代码
<android.support.v7.widget.SwitchCompat
android:id="@+id/sc_push"
style="@style/switchStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:theme="@style/switchStyle"
app:theme="@style/switchStyle" />
Run Code Online (Sandbox Code Playgroud)
这是我的style.xml文件
<style name="switchStyle">
<item name="colorControlActivated">@color/red</item>
<item name="android:colorForeground">@color/gray</item>
</style>
Run Code Online (Sandbox Code Playgroud)
看来问题是什么?
另外,我无法更改活动的颜色或基本应用程序的颜色.我必须改变这个单一视图的颜色.