我正在尝试创建一个PHP脚本,以从Android APK文件中获取应用程序版本.从APK(zip)文件中提取XML文件然后解析XML是一种方法,但我想它应该更简单.像PHP手册,例如#3.任何想法如何创建脚本?
我想知道怎么可能在Android键盘上制作自定义形状键.创建自定义键盘相对容易,但创建新按钮需要做些什么.他们还需要像普通键盘一样响应所有事件.
任何想法从哪里开始?
随着夜间模式的变化,我要改变背景。
我有 /values 和 /values-night 文件夹,其中包含具有不同值的“colors.xml”。`
<color name="grey1">#ebebeb</color>
<color name="grey2">#c7c7c7</color>
<color name="grey3">#999999</color>
<color name="hover1">#8bb065</color>
<color name="red1">#ba0000</color>
<color name="red2">#ff0000</color>
<color name="green1">#336600</color>
<color name="text1">#000000</color>
Run Code Online (Sandbox Code Playgroud)
另一个是
<color name="grey1">#999999</color>
<color name="grey2">#333333</color>
<color name="grey3">#000000</color>
<color name="hover1">#8bb065</color>
<color name="red1">#ba0000</color>
<color name="red2">#ff0000</color>
<color name="green1">#336600</color>
<color name="text1">#ffffff</color>
Run Code Online (Sandbox Code Playgroud)
这些颜色用于背景“activity_main_bg2.xml”的图层列表:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="@color/grey1" />
</shape>
</item>
<item
android:bottom="1dp"
android:left="1dp"
android:right="1dp">
<shape android:shape="rectangle" >
<solid android:color="@color/grey2" />
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
我的活动包含片段:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world_dark"
android:background="@drawable/activity_main_bg2" />
Run Code Online (Sandbox Code Playgroud)
当我改变时间从白天到黑夜或背景中的背景颜色不会改变。但如果我使用
android:background="@color/grey1"
Run Code Online (Sandbox Code Playgroud)
一切正常。
如何解决这个问题?这是安卓bug吗?
xml android uimanager android-configchanges android-drawable
如何将JSON支持添加到dispatch-servlet.xml(XML工作没有问题)?
评论文本只是失败的尝试......
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
<context:annotation-config/>
<context:component-scan base-package="com.example"/>
<oxm:jaxb2-marshaller id="marshaller" contextPath="com.example.domain"/>
<beans:bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<beans:property name="messageConverters">
<beans:list>
<beans:bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
<beans:constructor-arg ref="marshaller"/>
</beans:bean>
<!-- <beans:bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<beans:constructor-arg ref="marshaller"/>
</beans:bean> -->
</beans:list>
</beans:property>
</beans:bean>
<beans:bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<beans:bean name="note" class="org.springframework.web.servlet.view.xml.MarshallingView">
<beans:constructor-arg ref="marshaller"/>
</beans:bean>
<!-- <beans:bean name="note" class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
<beans:constructor-arg ref="marshaller"/>
</beans:bean> -->
<!-- InternalResourceViewResolver should be the last sice it always returns/resolves a view -->
<beans:bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="viewClass" …
Run Code Online (Sandbox Code Playgroud) 我卡住了,可能在文档中遗漏了一些东西或犯了一些小错误.
Spring Security 3.0.5集成在我的Spring MVC 3.0.5应用程序中.AcceptHeaderLocaleResolver用于区域设置检测和本地化工作正常,但安全性错误消息除外.
我从spring安全包复制了messages.properties并重命名并添加到带有值列表的现有"messageSource"bean(ResourceBundleMessageSource).
如前所述,所有文本和消息都已正确本地化,除了安全接缝以使用硬编码的英语消息.
任何想法如何解决这个问题?
更新:
我的xy-servlet.xml包含:
...
<mvc:resources mapping="/resources/**" location="/resources/" />
...
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>defaultMessages</value>
<value>securityMessages</value>
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
和文件
defaultMessages.properties
defaultMessages_en.properties
defaultMessages_de.properties
defaultMessages_sl.properties
和
securityMessages.properties
securityMessages_en.properties
securityMessages_de.properties
securityMessages_sl.properties
但defaultMessages
工作还可以.securityMessages
才不是.我对所有securityMessages
文件进行了少量更改,但忽略了它们并显示了硬编码的英文消息.
更新v2:
我的dispatcher-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:sec="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<context:component-scan base-package="com.example.sampleapp1" />
<context:annotation-config />
<mvc:annotation-driven/>
<!-- Handles HTTP …
Run Code Online (Sandbox Code Playgroud) 我想覆盖android状态栏.就我而言,它位于顶部.我不想叠加或隐藏导航栏.
注意:解决方案必须适用于android 4.2.2+.我更喜欢非root设备的答案.
我搜索了许多SO问题和答案,但没有一个适用于4.2.2.
下面是我的代码,但它不消耗触摸事件.这就是状态栏打开其面板的原因.我不想要这个.
@Override
public void onCreate() {
super.onCreate();
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
int statusBarHeight = (int) Math.ceil(25 * getResources().getDisplayMetrics().density);
overlay = new Button(this);
overlay.setBackgroundColor(Color.GREEN);
overlay.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.i("StatusBar", "touched");
return false;
}
});
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FILL_PARENT,
statusBarHeight,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH|
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.TOP | Gravity.RIGHT;
windowManager.addView(overlay, params);
}
@Override
public void onDestroy() {
super.onDestroy();
if (overlay != null) windowManager.removeView(overlay);
}
Run Code Online (Sandbox Code Playgroud)
在主要活动中我开始服务:
startService(new …
Run Code Online (Sandbox Code Playgroud) android statusbar android-ui android-launcher android-4.2-jelly-bean