- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个小应用程序,它应该使用系统默认主题。但是我有两个问题:
首先,在一个 Activity (TemplateView) 上,Android 不应用主题 - 或者它与应用程序的其余部分确实不同。其次,ConfigurationView 上的微调器和按钮也不受主题影响。
我不会以编程方式触摸按钮和其他东西。唯一的是微调器的 ArrayAdapter,它使用了 andoird.R.layout.simple_spinner_dropdown_item,如果我没记错的话,它也应该是主题化的。
我一直在试图弄清楚,这里出了什么问题,但我似乎找不到。
我的 list
<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme" >
<activity
android:name="de.isogon.discotalker.viewController.ConfigurationController" android:theme="@android:style/Theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity><activity android:name="de.isogon.discotalker.viewController.TemplateController"></activity>
<activity android:name="de.isogon.discotalker.viewController.AboutController"></activity>
<activity android:name="de.isogon.discotalker.viewController.DisplayController"></activity>
</application>
</manifest>
ConfigurationView(通常除了按钮/微调器之外的主题)
<de.isogon.discotalker.views.ConfigurationView 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:id="@+id/tv_configHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/label_configuration"
android:textAppearance="?android:attr/textAppearanceLarge" />
<AutoCompleteTextView
android:id="@+id/actv_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/tv_configHeader"
android:layout_marginTop="10dp"
android:completionThreshold="1"
android:dropDownHeight="wrap_content"
android:dropDownWidth="match_parent"
android:ems="10"
android:hint="@string/hint_text" >
</AutoCompleteTextView>
<ScrollView
android:id="@+id/scrollView_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_start"
android:layout_below="@+id/actv_text" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Speed -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_speed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_speed" />
<SeekBar
android:id="@+id/sb_speed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="1" />
</LinearLayout>
<!-- Size -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_size"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_size" />
<SeekBar
android:id="@+id/sb_size"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="1" />
</LinearLayout>
<!-- Text Color -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_textColor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_textcolor" />
<Spinner
android:id="@+id/sp_textcolor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="1" />
</LinearLayout>
<!-- Text Backgroundcolor -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_textBackgroundColor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_textbackgroundcolor" />
<Spinner
android:id="@+id/sp_textBackgroundcolor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="1" />
</LinearLayout>
<!-- Backgroundcolor -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_backgroundcolor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_backgroundcolor" />
<Spinner
android:id="@+id/sp_backgroundcolor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="1" />
</LinearLayout>
<!-- Endless -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_endless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_endless" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<CheckBox
android:id="@+id/cb_endless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="right|center_vertical" />
</RelativeLayout>
</LinearLayout>
<!-- Vibrate/Sound -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_afterRun"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:text="@string/label_afterRun" />
<Spinner
android:id="@+id/sp_afterRun"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btn_start"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="@string/button_start" />
</de.isogon.discotalker.views.ConfigurationView>
TemplateView(主题完全不同 - 我不知道为什么)
<de.isogon.discotalker.views.TemplateView 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:id="@+id/tv_templatesHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="10dp"
android:text="@string/label_templates"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<ListView
android:id="@+id/lv_templateList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_templatesHeader"
android:layout_above="@+id/rl_containerButtons">
</ListView>
<LinearLayout
android:id="@+id/rl_containerButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/btn_edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/button_edit"
android:layout_weight="1"/>
<Button
android:id="@+id/btn_delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/button_delete"
android:layout_weight="1"/>
</LinearLayout>
</de.isogon.discotalker.views.TemplateView>
最佳答案
问题是,我使用 getContext() 方法扩展第一个 View ,并使用 getApplicationContext() 方法扩展另一个 View 。
关于android - 不同 Activity 的 Android 主题问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17338609/
这个问题已经有答案了: Cannot create AlertDialog: AppCompat error (2 个回答) 已关闭 6 年前。 当我在列表项中调用警报对话框时,我的应用程序崩溃了。我
我在 Angular 应用程序中安装了 Material UI,现在我收到错误,没有导出的成员 Observable 错误, 我删除了节点模块并重新安装,问题仍然存在 ERROR in node_mo
我有一个架构,其中有两个独立的应用程序。原始来源是一个sql数据库。 App1 监听 CDC 表以跟踪对该数据库中表的更改、规范化和序列化这些更改。它获取这些序列化消息并将它们发送到 Kafka 主题
这个问题在这里已经有了答案: Material Design, AppCompat, and Backwards Compatibility (1 个回答) 关闭 6 年前。 我收到如下错误信息:
我喜欢新 Office 套件和 Visual Studio 上的窗口镶边: 当然,我仍在为 Windows 7 开发应用程序,但我想知道是否有一种快速且简单的方法(阅读:WPF 样式或 Windows
我正在使用 HoloEverywhere-1.6.8。 我有一个基于 Holo.Theme 的自定义主题。 ... 我遇到了下面的崩溃,但它只出现在以下设备上: Galaxy Tab 10.1 P
我正在尝试为 Angular 的 DevExtreme 小部件加载主题。我采用了不同的方法: 在 angular.json 中设置样式但不会产生任何影响: "projects": { "my-proj
我想定义一个 android 样式,它扩展了一个在不同的应用程序/包中定义的样式,而不是作为库导入。 从对android资源的xml引用的定义here : @[:]/ 似乎可以在定义资源的地方指定一个
我正在尝试测试一种制作主题的方法,但我使用的方法并没有给我预期的结果。这是我的设置: drawable/dummy.xml 值/mythemes.xml @style
通过 telnet 使用 IMAP,我希望能够从特定的给定电子邮件中提取主题。现在我知道 fetch 命令负责从电子邮件中获取数据。 我的问题是,如何在不使用对 BODY[HEADER.FIELDS
我刚刚开始使用 RStudio 中的一些新的 knitr 功能。 我已经尝试在 R Markdown 设置对话框中选择几个不同的主题,但这些似乎对我生成的文档的样式没有任何明显的影响。应该,还是我错过
在我的应用程序中,我有多种主题样式(您可以将它们视为不同的、单独的 CSS 样式文件)。我想开始使用 CSS 模块,但我什至不知道如何 import我的第一个文件。 让我们假设以下(简单)目录结构:
有没有一种方法可以在一个 Azure 主题订阅上拥有多个监听客户端,并且它们都接收所有消息?我的理解是订阅的唯一实现是发布的消息仅传递到该订阅上的一个客户端,因为它就像一个队列。 可以使用同一订阅将这
我有一台 super 光滑的显示器,所以白天我可以比深色主题上的代码更好地看到自己的倒影。因此,我认为如果我可以在 vimrc 中有一个简单的 if 开关来根据一天中的时间设置深色主题或浅色主题,那就
我希望在我的 Symfony2 项目中提供基本的主题支持,因此我希望为每个主题提供单独的静态文件(css、js、img)。 我尝试添加 assetic: read_from: %kernel
有没有一种方法可以在一个 Azure 主题订阅上拥有多个监听客户端,并且它们都接收所有消息?我的理解是订阅的唯一实现是发布的消息仅传递到该订阅上的一个客户端,因为它就像一个队列。 可以使用同一订阅将这
在 NES 上有多个处于 WAITING 状态的“Discovery Worker”和“Keep Alive”线程是预期的行为吗? "DiscoveryWorker-10" Id=62 WAITING
我正在尝试找到最适合加载图像的颜色并将其应用到背景中。适应图像并使 UI 感觉更自然。 到目前为止我已经找到了 2 个方案: 1> 平均像素(下面的代码): final Color acclimati
我知道每个请求都由一个 servlet 线程提供服务,但是对于一个用户 session ,两个请求是否可以由两个不同的线程提供服务? 如果上述情况真的发生,那么第一个请求服务线程存储的线程局部变量被第
我无法理解操作栏外观与主题化之间的交互模式。我的应用设置为使用默认主题,我认为它是深色的: 通过应用范围内的样式从应用中删除操作栏会导致主要 Activity 的黑色背景: 没有 and
我是一名优秀的程序员,十分优秀!