使用xml时,如何在按下按钮时更改文本和背景颜色?
要更改文字颜色,我可以这样做:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="mycolor"/>
<item android:color="mycolor2/>
</selector>
Run Code Online (Sandbox Code Playgroud)
要改变我可以做的背景(在带有可绘制参考的选择器/项目中使用它):
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FF0079FF" />
</shape>
Run Code Online (Sandbox Code Playgroud)
但我怎么能两个都做?假设我想拥有:
我完全忘了背景和文字颜色是分开管理的,所以我就是这样做的:
<Button
android:textColor="@color/filtersbuttoncolors"
android:background="@drawable/mybackgroundcolors" />
Run Code Online (Sandbox Code Playgroud)
在mybackgroundcolors.xml中我管理背景,在filtersbuttoncolors.xml中我管理文本颜色.在两个xml文件中我管理状态(按下,选中,默认)
我启动了PreferenceActivity,我以编程方式添加了一些首选项屏幕.所以我有一个列表与我的偏好屏幕.
例:
所以我迭代并调用一个函数(Board是一个自定义对象):
private PreferenceScreen CreatePreferenceScreen(Board b) {
PreferenceScreen p = getPreferenceManager().createPreferenceScreen(this);
p.setPersistent(true);
p.setKey("preferenceScreen_" + b.getId());
PreferenceCategory general = new PreferenceCategory(this);
general.setTitle("General");
p.addPreference(general);
Preference delete = new Preference(this);
delete.setTitle("delete");
final PreferenceScreen pFinal = p;
delete.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
String delId = board.getId();
PreferenceCategory themes = (PreferenceCategory) findPreference("themes");
PreferenceScreen screen =(PreferenceScreen)findPreference("preferenceScreen_" + delId);
themes.removePreference(screen);
/*GO BACK TO PREFERENCEACTIVITY HERE OR KILL THIS SCREEN*/
return true;
}
});
general.addPreference(delete);
return p;
} …Run Code Online (Sandbox Code Playgroud) 我正在使用springboot,但我不希望它在maven-war-plugin任务期间复制我的webapp文件夹,因为它包含很多文件,如bower_components文件夹.我正在使用咕噜声,所以我正在为我的战争添加另一个文件夹.
[INFO] --- maven-war-plugin:2.6:war (default-war) @ saturne ---
[INFO] Packaging webapp
[INFO] Assembling webapp [saturne] in [D:\Workspaces\MyProject\trunk\target\saturne-1.0.0]
[INFO] Processing war project
...
[INFO] Copying webapp resources [D:\Workspaces\MyProject\trunk\src\main\webapp]
Run Code Online (Sandbox Code Playgroud)
我尝试了很多事情就像是排除<resources>或类似
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<exclude>**/*</exclude>
</resource>
</webResources>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我找不到从资源副本中排除它的方法.
我正在使用带有maven的SpringBoot 1.3.5.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
Run Code Online (Sandbox Code Playgroud)
和devtools
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我正在使用2014年以前的Intellij IDEA 2016.2同样的问题.
我正在从Intellij Idea运行我的springboot应用程序,首先启动一切都很好并且可以工作,我可以访问我的静态页面和我的2个Rest Controller工作.
2016-08-18 15:27:58.771 INFO 26626 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@469d0c02: startup date [Thu Aug 18 15:27:57 CEST 2016]; root of context hierarchy
2016-08-18 15:27:58.789 INFO 26626 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authentication/introspect],methods=[GET]}" onto public com.myapp.models.TokenIntrospection com.myapp.resources.AuthenticationResources.introspectToken(java.lang.String)
2016-08-18 15:27:58.790 INFO 26626 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/configuration],methods=[GET]}" onto public com.myapp.models.AppConfiguration com.myapp.resources.ConfigurationResources.getConfiguration()
2016-08-18 15:27:58.792 INFO 26626 --- [ restartedMain] …Run Code Online (Sandbox Code Playgroud) 如果用户选择Facebook或Twitter或Mail等,I'va子类化UIActivityItemProvider能够选择共享内容.但我只能在函数 - (id)项目中共享文本或图像,我不知道如何共享两者例如文本和图像.
如果我阅读教程,我知道如何为所有共享选项做,但我不希望所有共享选项都有图像或链接或文本:
NSArray* dataToShare = @[someText, [NSURL URLWithString:url], image];
UIActivityViewController* activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:dataToShare
applicationActivities:nil];
Run Code Online (Sandbox Code Playgroud) 我们将 Keycloak 4.8.1.Final 部署在具有两个默认设置的节点的 k8 集群上。后端数据库是 PostgreSQL。
我们正在增加 Keycloak 中的领域数量,以确定 Keycloak 是否可以支持更多领域;这些创作是按顺序完成的。
然而,当领域的数量达到 470 左右时,它使得 keycloak 基本无法使用,管理 GUI 根本不加载,请求执行时间太长。
以下是所用时间的摘要。我们尚未向领域添加任何用户。
+--------------+----------+------------+------------+------------+
| Operation | 0 realms | 100 realms | 250 realms | 350 realms |
+--------------+----------+------------+------------+------------+
| Create realm | 1104 | 3739 | 8659 | 11535 |
| Get realm | 128 | 961 | 3067 | 3853 |
| Get token | 636 | 1159 | 2714 | 3197 |
| Get roles | 127 | 1037 …Run Code Online (Sandbox Code Playgroud) 我正在尝试同时查询包含 Realm 中字符串值列表的多个字段。假设我有以下对象:
public class Article extends RealmObject implements Serializable{
@PrimaryKey
@Required
private String aID = UUID.randomUUID().toString();
private String title;
private String description;
private String authors;
private RealmList<Tag> tags;
}
Run Code Online (Sandbox Code Playgroud)
我想查询所有文章的标题、描述或标签包含字符串列表。
我知道谓词“ in ”可用于将值列表与字段匹配,如下所示:
realm.where(Article.class)
.in("title", listOfValues,Case.INSENSITIVE)
.or()
.in("description", listOfValues, Case.INSENSITIVE)
.or()
.in("tags.tag",listOfValues, Case.INSENSITIVE)
.findAll();
Run Code Online (Sandbox Code Playgroud)
这只会返回“匹配”值,但我正在寻找“包含”值。还有“包含”谓词,但我认为它只能与一个值进行比较。
有没有办法做到这一点?
我有一个简单的存储库
@Repository
public interface SurgeryIndexRepository extends ElasticsearchRepository<SurgeryIndexEntity, UUID> {}
Run Code Online (Sandbox Code Playgroud)
当我打电话的search方法,这样surgeryIndexRepository.search(query, pageable)我得到一个页面响应totalPages = 1,numberOfElements=40,totalElements=7200.事情是错误的totalPages,我应该有180.
我的Pageable是Page request [number: 0, size 40, sort: date: DESC]
我正在使用 Maven: org.springframework.data:spring-data-elasticsearch:3.0.6.RELEASE
尝试将应用程序构建到 iOS 设备(任何设备 iPhone X、XS、任何操作系统,如 12,13 测试版)获得证书问题。
想要在 ios 13 beta OS 支持的设备上构建应用程序并调试问题。我要在模拟器上构建应用程序。证书的自动管理在 Xcode 10.2 上工作正常
应该能够从 Xcode 11 beta 在设备上安装应用程序以进行调试。
Xcode 11 beta 证书问题
从大约一两个星期前开始,我根本无法使用 pip,因为它总是会返回以下错误:
错误:由于环境错误,无法安装包:HTTPSConnectionPool(host='files.pythonhosted.org', port=443):超过最大重试次数,网址为:/packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b9andb83p3p. .gz(由 SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1122)') 引起))
我已经在公司 VPN 内外对其进行了测试,甚至在我的个人笔记本电脑上进行了测试(运行 Mojave,而不是在我的主笔记本电脑上运行 Windows 10)。我的家庭互联网以及我手机上的热点。同样,我已经远程连接到我公司的一台澳大利亚机器并且遇到了同样的问题。
我没有更新我的 python 版本 (3.9.0) 或 pip 版本 (20.2.3),也没有改变我的 pip 用法,所以突然出现了一个非常令人困惑的问题。https://status.python.org/表示一切都在进行中。
有什么我做错了吗?
完整的 CMD 文本(如果有帮助):
C:\Users\Caleb.Clough\Digital>pip install pandas
Run Code Online (Sandbox Code Playgroud)
收集大熊猫
警告:在连接被 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1122)'))':/packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b8b8aabc91edb03f2ba65/pandas-1.1.1.1.3.3.1.1.1.1.3.3.3.1.1.1.3.3.3.3 None, redirect=None, status=None)) 在连接被 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获得本地颁发者证书 (_ssl.c:1122)'))' 中断后: /packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b8b8aabc91edb03f2ba65/pandas-1.1.3.tar.gz
警告:连接被 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1122)'))': /packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b8b8aabc91edb03f2ba65/pandas-1.gz.3.
警告:连接被 'SSLError(SSLCertVerificationError(1, '[SSL:CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1122)'))': /packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b8b8aabc91edb03f2ba65/pandas-1.gz.3.
警告:连接被 'SSLError(SSLCertVerificationError(1, '[SSL:CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1122)'))': /packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b8b8aabc91edb03f2ba65/pandas-1.gz.3.
错误:由于环境错误,无法安装包:HTTPSConnectionPool(host='files.pythonhosted.org', port=443):超过最大重试次数,网址为:/packages/1b/e5/552ba65835ab43e12b299458fea94ee23886125b9andb83p3p. .gz(由 SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 …
android ×3
spring ×3
ios ×2
maven ×2
background ×1
button ×1
certificate ×1
cmd ×1
colors ×1
facebook ×1
java ×1
keycloak ×1
objective-c ×1
pip ×1
python ×1
realm ×1
realm-java ×1
share ×1
spring-boot ×1
spring-data ×1
ssl ×1
status ×1
twitter ×1
xcode ×1