- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个 ListView,它在手机上运行良好。现在我正在制作一个平板电脑 UI,左侧是 ListView,右侧是详细信息。
当我触摸一个项目时,只要按下它就会闪烁蓝色。我想在选择另一个项目之前一直保持蓝色,就像 Nexus 7 上的 Gmail 应用程序一样。
实现该目标的最简洁方法是什么?我宁愿避免手动设置背景,我假设有一种方法可以将元素标记为“Activity ”元素并相应地设置主题。
最佳答案
What is the cleanest way to achieve that?
您正在寻找的是所谓的“激活”状态。为了使这项工作:
第 1 步:在 res/values-v11/
中,有一个实现 activated
的样式资源。例如,对于一个在那里定义了 AppTheme
声明的新项目,使用如下内容:
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light"></style>
<style name="activated" parent="AppTheme">
<item name="android:background">?android:attr/activatedBackgroundIndicator</item>
</style>
</resources>
第 2 步:在 res/values/
中为任何旧设备定义相同的样式,就像 stub 样式资源一样,因此对它的引用可以继续工作:
<resources>
<style name="AppTheme" parent="android:Theme.Light"/>
<style name="activated" parent="AppTheme"/>
</resources>
第 3 步:在 ListView
中行的布局 XML 资源中,将 style="@style/activated"
添加到根的属性列表中元素
第 4 步:将 ListView
设置为单选列表,例如 ListFragment
中的以下行:
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
您可以在 this sample project 中看到实际效果, this sample project , 和 this sample project .有关前两个示例的更多背景信息,请参阅此 SO 问题:Complete Working Sample of the Gmail Three-Fragment Animation Scenario?
关于Android:选择ListView后保持蓝色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12386333/
我有一个 datagridview,它的唯一目的是显示来自数据库的信息。出于某种原因,我还添加了额外的列,每一行都有“查看”链接。所以基本上 datagridView 的目的只是让用户单击“查看”链接
当按下我的按钮时,我不希望它的外观发生变化。当我触摸它时它会变成蓝色。我尝试进入 IB 并取消选中“突出显示调整图像”,但这似乎没有改变任何东西。我还没有选中“显示高亮显示触摸”。我如何禁用此功能?感
我是 CSS 和一般编程的新手,所以如果这是一个初学者问题,我很抱歉,但我自己找不到合适的解决方案。 如果我有特定的颜色代码(十六进制),例如#028dca,我怎样才能得到匹配的颜色? 我在网上找到了
Fiddler中这个图标是什么意思: 它未在 help 中列出. 最佳答案 此图标用于回复 Content-Type=Content-Type: text/html; 关于fiddler - 蓝色<>
默认的 UIButton 圆角矩形是深蓝色的。我希望表格中单元格的文本与这种蓝色相匹配。 我正在使用此代码,但我能找到的唯一蓝色是亮蓝色... cell.textLabel.textColor = [
我试过这个: myButton.highlight(true) 但这只会使按钮变成深蓝色,这就是按钮的“按下”状态。 此外,当我按键盘上的 Enter 键时,该按钮将不起作用。 当我按下回车键时,如何
我有一个 iOS 6 应用程序,它使用以下方法将所有导航栏按钮的色调颜色设置为绿色: [[UIBarButtonItem appearance] setTintColor:[UIColor color
当我创建一个 TreeView 控件时,插入几个项目,然后我使用 TVM_SELECTITEM 选择一个默认项目。但是这个项目没有用蓝色突出显示。稍后,如果我使用鼠标或键盘选择一个项目,它将突出显示。
目前我有代码: import random from psychopy import visual, event win = visual.Window() # A TextStim and five
如何更改 UISwitch 的默认颜色(蓝色)? 最佳答案 我想你要找的是这样的东西 UISwitch *testSwitch; //just something I made up [testSwi
我有一个 MKMap 和一系列 MKAnnotations,所有这些都是红色的,这很好。我在 IB 中选择了“显示用户位置”并将 MKAnnotation 从红色更改为蓝色,我的 viewForAnn
我正在尝试使用 C++ 和 openCV 检测下图中的 3 个蓝色圆圈。 我用这个代码 int main(){ Mat original=imread("img.jpg"); Ma
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: C# Textbox string separation 我想将字符串值即 (red,blue,black)
我正在使用 cocos2d 库制作 iOS 游戏。 假设您有两个具有两种不同颜色的对象 - 在 RGB 中定义为 Blue: 0,0,255 Yellow: 255,255,0 我想添加蓝色和
有没有办法轻松地将给定的十六进制颜色代码分配给更一般的类别(红色、绿色、蓝色、黄色、橙色、粉色、黑色、白色、灰色……)? 比如 #ffcc55 -> 橙色,#f0f0f0 -> 白色,... 编辑:甚
我创建了一个 UIButton: testNavigationButton.setTitle("Test", forState: .Normal) testNavigationButton.layer
我正在尝试编写一个裸机程序来闪烁绿色 LED。事实上,我无法打开或关闭任何 LED。这是一个现成的板。主板名称为 NUCLEO F429ZI。 Board Image 我已经浏览了原理图,并且确信引脚
我们已经使用对话流创建了一个聊天机器人。现在,我们想要对其进行测试,并需要一些测量或分析数据以确保该机器人已准备好向公众开放。我们使用对话框流中的“分析”功能的方法之一。但是,他们的文档中没有包含任何
我可以在设置 Pane 中更改我的应用程序(任何地方)的tintColor。当我更改tintColor,然后尝试返回到默认色调颜色时,导航栏中的某些按钮不会返回蓝色,我该如何处理这个问题? 验证:-
我希望使用非常明亮的金属色或荧光色来指定我的文本和 div 颜色。我还没有找到显示这些的任何标准。这些是否存在于颜色规范中,或者您能否向我推荐任何接近的尝试。谢谢。 最佳答案 Here's一个很好的荧
我是一名优秀的程序员,十分优秀!