您好我正在尝试为View添加一个涟漪效果onClick方法,但这个没有用.我的所有物品都有身份证,但我不知道怎么称呼它
这是一个代码.
@Override
public void onClick(View v) {
int[] attrs = new int[]{R.attr.selectableItemBackground};
TypedArray typedArray = getActivity().obtainStyledAttributes(attrs);
int backgroundResource = typedArray.getResourceId(0, 0);
v.setBackgroundResource(backgroundResource);
switch (v.getId()) {
case ACTION_PLAY_ID:
Log.d(MainActivity.TAG, getString(R.string.detail_action_play));
v.setBackgroundResource(backgroundResource);
Intent intent = new Intent(getActivity(), PlayerActivity.class);
intent.putExtra(Video.VIDEO_TAG, videoModel);
startActivity(intent);
break;
case ACTION_BOOKMARK_ID:
if (bookmarked) {
v.setBackgroundResource(backgroundResource);
deleteFromBookmarks();
((ImageView) v).setImageDrawable(res.getDrawable(R.drawable.star_outline));
} else {
v.setBackgroundResource(backgroundResource);
addToBookmarks();
((ImageView) v).setImageDrawable(res.getDrawable(R.drawable.star));
}
break;
case ACTION_REMINDER_ID:
if (!isReminderSet) {
createReminderDialog((ImageView) v);
} else {
cancelReminder(liveTvProgram.getProgramId());
((ImageView) v).setImageDrawable(res.getDrawable(R.drawable.alarm));
}
break;
}
}
Run Code Online (Sandbox Code Playgroud)
对于Lubomir
我有类似的东西,但也没有工作:
@Override
public …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 javaxmail 通过 for 循环发送 500 多封电子邮件 - 没有垃圾邮件,电子邮件地址已知并经过认证。
目的是在发送 (Thread.sleep(...)) 之间有一点时间延迟(1 - 5 秒),这样邮件就不会自动进入垃圾邮件文件夹。但在通过将其发送到我自己的电子邮件地址进行测试一段时间后,我不断收到此错误:
com.sun.mail.smtp.SMTPSendFailedException: 554 5.7.0 无法发送您的邮件。超出了允许的传出消息数量的限制。稍后再试。
我正在使用我们自己的 smtp 服务器。
properties.setProperty("mail.smtp.auth", "true");
properties.setProperty("mail.smtp.host", host);
properties.setProperty("mail.smtp.port", "25");
Run Code Online (Sandbox Code Playgroud)
我想知道“稍后再试”的时间间隔是多长?
有谁知道极限吗?
此外,任何如何避免这种情况的建议都会有所帮助。
当我的用户玩游戏时,我想将他们锁定30秒钟。我正在尝试使用SharedPreferences
。我对SP不太熟悉,也不完全知道如何使用它。所以应该看起来像这样
ifGameOver(){
//lock the game for 30 seconds
//send users to main menu until 30seconds is over
}
Run Code Online (Sandbox Code Playgroud)
然后在主菜单上,我希望能够随着30秒的下降而看到TextView的计数。所以在这里我会getLong
或某事(?)。谁能对此有所启示?