我有一个名为:preference的应用程序,我想为这个应用程序制作主题.我的首选AndroidManifest.xml是:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.preference.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
在MainActivity.java中:我收到了主题更改按钮,点击:
themeChange = (Button) findViewById(R.id.themeChange);
themeChange.setOnClickListener(this);
Run Code Online (Sandbox Code Playgroud)
我有一个主题应用程序,其中包含PinkTheme(styles.xml),包名称为com.example.theme.
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<style name="PinkTheme" parent="AppBaseTheme" >
<item name="android:textColor">#FF69B4</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">40sp</item>
<item name="android:windowBackground">#008000</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
我喜欢的onClick()是:
public void onClick(View v) {
// TODO Auto-generated method stub …Run Code Online (Sandbox Code Playgroud) 我有一个PHP脚本,显示时间像:9.08374786377E-5,但我需要简单的浮动值作为时间像:0.00009083747 .....这就是为什么我只是用它浮动打印它:
<?php
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
$time_end = microtime_float();
$time = $time_end - $time_start;
printf('%.16f', $time);
?>
Run Code Online (Sandbox Code Playgroud)
它很好地显示了结果,但我需要在新变量中设置此打印值.我怎样才能做到这一点 ?我需要在新变量$ var中设置此打印值;
$var = printf('%.16f', $time);
Run Code Online (Sandbox Code Playgroud)
//我们都知道它不起作用,但如何设定?