让我们从一个例子开始吧
<attr name="spinnerDropDownItemStyle" format="reference" />
Run Code Online (Sandbox Code Playgroud)
我如何区分并理解它?
我看到Android主题和风格揭秘 - 谷歌I/O 2016多次谈话,我仍然不明白这个参考的东西是如何工作的.
我希望有一个活动(2),半透明的方面超过另一个活动(1),在屏幕的顶部对齐(4).

我尝试将这些主题分配给活动编号2:
<style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/black</item>
</style>
<style name="CustomTheme">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但结果总是3.
如果我<item name="android:windowIsFloating">false</item>在CustomTheme结果中设置为2.
谁能告诉我怎样才能得到4?谢谢!
更新:这是我的活动2布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:background="#0000">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#FFFFFF">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Menu" android:layout_centerHorizontal="true"/>
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使我的ICS(API级别15)应用程序与Gingerbread(API级别10)兼容,并且我得到InflateException Error inflating class <Unknown>任何具有?android:attr/属性的布局XML .如果我注释掉这些属性,我可以编译并运行应用程序,但当然,它看起来很糟糕.
我宁愿不复制android.R.attr我正在使用的所有项目,但目前我迷失了另一种方式来做到这一点.
我正在使用ActionBarSherlock来使ActionBar正常工作,而我似乎并没有使用任何其他需要支持库的东西(尽管我在尝试解决这个问题的过程中将其包含在内),只是这些主题 - 基础资源,我坚持.
我正在使用的一些主题资源是:
?android:attr/textColorSecondaryInverse
?android:attr/textAppearanceLarge
?android:attr/dividerVertical
?android:attr/selectableItemBackground
?android:attr/textAppearanceMedium
?android:attr/dividerVertical
?android:attr/dividerHorizontal
我包括我的样式的xml布局:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Styled" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/Widget.MyApp.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyApp.ActionBar</item>
</style>
<style name="Widget.MyApp.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
<item name="titleTextStyle">@style/Widget.MyApp.TitleTextStyle</item>
<item name="background">@color/red</item>
<item name="android:background">@color/red</item>
<item name="windowContentOverlay">@null</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="Widget.MyApp.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">21sp</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
一些关于互联网的搜索建议使用windowContentOverlay设置为@null.但是当我在xml风格中使用它时,它不会改变任何东西.任何人都可以帮忙做什么?
有人能告诉我Holo中所选列表项的相应颜色代码吗?另外,在Holo中生成长按列表项目转换的颜色是什么?我知道Holo颜色是在colors.xml中定义的,但我不确定哪些用于选择和长按列表项转换.提前致谢.
当使用Theme.Sherlock.Light.DarkActionBar(或Theme.Holo.Light.DarkActionBar没有区别)时,例如在选择文本时出现的ActionMode(或"上下文ActionBar")默认情况下与标准黑暗主题中的样式相同,即带有光的深蓝色行动图标.
但是,当您尝试在对话框中选择文本时(在此主题中为浅色调,与黑色ActionBar形成对比),将显示与Light主题(白色背景)中样式相同的ActionMode.问题是,它的动作图标不是应该是暗的,而是亮的,使它们实际上不可见.

这看起来好像背景是从光主题中获取的(因为光对话框),但是图标是从黑暗主题中拍摄的.这是Light.DarkActionBar主题中的错误吗?我能为此做些什么吗?
我正在开发一个应用程序,我为TextViews设置了"android:textIsSelectable".
但我的材料主题与TextSelection appBar不匹配.有没有办法可以改变appBar的颜色?
附上下面的图片检查: -

在我的应用程序中,我试图android:Theme.Material在styles values-21文件夹中实现为父主题:
<!-- res/values-21/styles.xml -->
<resources>
<!-- your theme inherits from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- theme customizations -->
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/accent</item>
<item name="android:navigationBarColor">@color/primary_dark</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
运行应用程序后,我到了下面 error
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
Run Code Online (Sandbox Code Playgroud)
在values文件夹中.我有以下风格
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize …Run Code Online (Sandbox Code Playgroud) android android-appcompat android-theme android-styles material-design
TabLayout我的应用程序中有两种不同的样式:
<style name="TabLayoutPower" parent="Widget.Design.TabLayout">
<item name="tabSelectedTextColor">@android:color/white</item>
<item name="tabTextColor">@android:color/white</item>
</style>
<style name="TabLayoutFree" parent="Widget.Design.TabLayout">
<item name="tabSelectedTextColor">@android:color/black</item>
<item name="tabTextColor">@android:color/black</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如何定义TabLayout主题的默认样式?我找不到任何信息,我应该使用哪个项目名来构建我的主题.我想像添加listview一样添加TabLayout:
<style name="Free" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="colorAccent">@color/main_red</item>
<item name="android:windowBackground">@color/main_bg_light</item>
<item name="android:listViewStyle">@style/MyListView</item>
</style>
Run Code Online (Sandbox Code Playgroud) 开始接触Google支持库的新更新,我想实现Theme.AppCompat.DayNight进入我的应用程序.
我遇到的问题是,似乎没有人解释如何自定义它.所以,如果我想要colorAccent一天与另一个不同的夜晚,我该怎么做?你应该指定不同的黑暗和光明主题吗?提前致谢!
android android-appcompat android-theme android-support-library