使用此代码我只有淡入淡出,我正在寻找如何添加淡出.我添加了另一个名为"fadeout"的xml,但我无法将其集成到我的代码中.
ImageView imageView = (ImageView)findViewById(R.id.imageView);
Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein);
imageView.startAnimation(fadeInAnimation);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
imageView.startAnimation(fadeInAnimation);
}
}
Run Code Online (Sandbox Code Playgroud)
fadein.xml
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="Your Duration(in milisecond)"
android:repeatCount="infinite"/>
</set>
Run Code Online (Sandbox Code Playgroud) 遵循几个howto但我无法理解,
如何使用 addPreferencesFromResource(R.xml.preferences)因为已弃用.
最好的方法是使用fragment但片段仅在3.0以后可用,我需要为Android版2.x做
我会遵循哪种方式?
我有一个复选框和一个ListPreference,我想通过复选框禁用/启用ListPreference.我读了很多,我发现只能使用java(而不是xml).这是对的吗?现在,在读取"checkboxPref"的值(布尔值为true/false)后,我不怎么做.
SharedPreferences prefs3 = PreferenceManager.getDefaultSharedPreferences(this);
listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs, String listpref) {
CheckboxPreference = prefs.getBoolean("checkboxPref", true);
} };
prefs3.registerOnSharedPreferenceChangeListener(listener);
Run Code Online (Sandbox Code Playgroud)
的preferences.xml:
<CheckBoxPreference
android:title="Notifify"
android:defaultValue="true"
android:key="checkboxPref" />
<ListPreference
android:entries="@array/numberOptions"
android:entryValues="@array/numberValues"
android:key="number"
android:title="Number" />
Run Code Online (Sandbox Code Playgroud) 错误信息是:
command not in docroot (/home/site1/cgi-bin/test.pl).
Run Code Online (Sandbox Code Playgroud)
在这里我发现了这个:
suexec要求CGI脚本位于服务器的DocumentRoot(而不是VirtualHost DocumentRoot)下.但是,允许VirtualHost DocumentRoot成为真实DocumentRoot下显示的目录的符号链接.
虚拟主机配置的一部分是:
[...]
DirectoryIndex index.html index.html index.php
DocumentRoot /home/site1/htdocs
SuexecUserGroup site1 site1
ScriptAlias /cgi-bin/ /home/site1/cgi-bin/
<Location /home/site1/cgi-bin>
Options +ExecCGI
</Location>
<Directory /home/site1/>
Options -Includes -Indexes -FollowSymLinks +ExecCGI MultiViews
AddHandler cgi-script .cgi .pl
AllowOverride none
Order allow,deny
Allow from all
</Directory>
[...]
Run Code Online (Sandbox Code Playgroud)
所以,我更喜欢在cgi-bin中使用Perl脚本,但是如果我无法解决这个问题,我可以将所有脚本移动到htdocs.
我使用的是fail2ban v.0.8.2,但我无法取消IP:
使用fail2ban-client我看到IP:
fail2ban-client status fail2ban
Status for the jail: fail2ban
|- filter
| |- File list: /var/log/fail2ban.log
| |- Currently failed: 1
| `- Total failed: 8
`- action
|- Currently banned: 2
| `- IP list: 151.10.65.197 151.10.72.169
`- Total banned: 2
Run Code Online (Sandbox Code Playgroud)
从手册页应该足够做:
fail2ban-client get fail2ban actionunban 151.10.65.197
Run Code Online (Sandbox Code Playgroud)
输出命令不会返回错误,但是:
iptables -L -nv |grep -b2 -a1 151
16262- pkts bytes target prot opt in out source destination
16351: 0 0 DROP all -- * * 151.10.72.169 0.0.0.0/0
16440: 0 …Run Code Online (Sandbox Code Playgroud) 我已经使用以下代码每天只设置一次alarmmanager,我希望有2个不同的时间设置,所以每天2次.
我的代码:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 35);
calendar.set(Calendar.SECOND, 0); AlarmManager am = (AlarmManager) getApplicationContext().getSystemService (Context.ALARM_SERVICE);
PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(getApplicationContext(), AlarmReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);
Run Code Online (Sandbox Code Playgroud) 首先,我的应用程序将首选项设置为"true"关于checkboxpreference.现在我需要以编程方式设置此值(android:enabled ="true")或false.任何的想法?
protected void checkLicense(){
PackageManager manager = getPackageManager();
if (manager.checkSignatures("core.package.name", "key.package.name")
== PackageManager.SIGNATURE_MATCH) {
//full version
isEnabled = true;
Toast.makeText(this, "pro", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(this, "free", Toast.LENGTH_LONG).show();
isEnabled = false;
<CheckBoxPreference
android:enabled="true"
android:title="Now"
android:defaultValue="false"
android:key="keep" />
Run Code Online (Sandbox Code Playgroud) 关于消息中的文字没有问题.我不能改变(个性化)alertdialog标题的颜色,字体,风格?
有什么办法?
谢谢!
我想在特定的日期和时间(2012年12月25日12点)显示一个对话框,我正在使用此代码.我设置为11个月(因为0是gen),但闹钟没有开始.我的错是什么?
Calendar cal=Calendar.getInstance();
cal.set(Calendar.MONTH,11);
cal.set(Calendar.YEAR,2012);
cal.set(Calendar.DAY_OF_MONTH,25);
cal.set(Calendar.HOUR_OF_DAY,12);
cal.set(Calendar.MINUTE,00);
cal.set(Calendar.SECOND,0);
Intent _myIntent = new Intent(context, Notify.class);
PendingIntent _myPendingIntent = PendingIntent.getBroadcast(context, 123, _myIntent, PendingIntent.FLAG_UPDATE_CURRENT| Intent.FILL_IN_DATA);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), _myPendingIntent);
Run Code Online (Sandbox Code Playgroud) 如果简化这个,最好的方法是什么?
#!/usr/bin/python
ans=input("choose yes or no: ")
if ans == "yes" or ans == "YES" or ans == "y" or ans == "Y":
print("ok")
else:
print("no")
Run Code Online (Sandbox Code Playgroud)