本文将带您了解关于css–如何在使用引导程序激活时更改按钮颜色?的新内容,同时我们还将为您解释引导样式的相关知识,另外,我们还将为您提供关于AlertDialog更改按钮颜色、android–如何在点
本文将带您了解关于css – 如何在使用引导程序激活时更改按钮颜色?的新内容,同时我们还将为您解释引导样式的相关知识,另外,我们还将为您提供关于AlertDialog更改按钮颜色、android – 如何在点击时更改按钮的颜色并暂停屏幕几秒钟?、asp.net – 如何在使用Html.TextAreaFor时更改字体和颜色?、css – 使用引导程序滑出面板的实用信息。
本文目录一览:- css – 如何在使用引导程序激活时更改按钮颜色?(引导样式)
- AlertDialog更改按钮颜色
- android – 如何在点击时更改按钮的颜色并暂停屏幕几秒钟?
- asp.net – 如何在使用Html.TextAreaFor时更改字体和颜色?
- css – 使用引导程序滑出面板
css – 如何在使用引导程序激活时更改按钮颜色?(引导样式)
我的代码是:
<divid=""> <button type="submit"id="1">Button1</button> <button type="submit"id="2">Button2</button> </div>
解决方法
:active : if you want background color only when the button is clicked and don’t want to persist.
:focus: if you want background color untill the focus is on the button.
button:active{ background:olive; }
和
button:focus{ background:olive; }
JsFiddle Example
P.S.:请不要给出html元素的Id属性中的数字.
AlertDialog更改按钮颜色
如果没有调用Show 方法AlertDialog.getButton(DialogInterface.BUTTON_POSITIVE) 为 null。AlertDialog 的逻辑是 show()方法 中初始化了 AlertDialog 上面的控件,然后展示出来,所以在 show()方法 执行之后才能得到 button。
final AlertDialog alertDialog = new AlertDialog.Builder(this).setTitle("sdd")
.setPositiveButton("kk",null).setNegativeButton("取消",null)
.setNeutralButton("dd",null).create();
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
button.setTextColor(Color.GREEN);
}
});
alertDialog.show();
不用费劲的去改主题了
---------------------
本文来自 cike978 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/cike978/article/details/74530488?utm_source=copy
android – 如何在点击时更改按钮的颜色并暂停屏幕几秒钟?
我已经在最后按钮上实现了颜色更改,但我不明白如何实现Handler延迟: –
public class QuestionActivity extends Activity implements OnClickListener{ private Question currentQ; private GamePlay currentGame; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.question); processSession(); } private void processSession(){ /** * Configure current game and get question */ currentGame = ((CYKApplication)getApplication()).getCurrentGame(); currentQ = currentGame.getNextQuestion(); Button nextBtn1 = (Button) findViewById(R.id.answer1); nextBtn1.setonClickListener(this); Button nextBtn2 = (Button) findViewById(R.id.answer2); nextBtn2.setonClickListener(this); Button nextBtn3 = (Button) findViewById(R.id.answer3); nextBtn3.setonClickListener(this); Button nextBtn4 = (Button) findViewById(R.id.answer4); nextBtn4.setonClickListener(this); Button nextBtn5 = (Button) findViewById(R.id.answer5); nextBtn5.setonClickListener(this); /** * Update the question and answer options.. */ setQuestions(); } /** * Method to set the text for the question and answers from the current games * current question */ private void setQuestions() { //set the question text from current question String question = Utility.capitalise(currentQ.getQuestion()); TextView qText = (TextView) findViewById(R.id.question); qText.setText(question); //set the available options List<String> answers = currentQ.getQuestionoptions(); TextView option1 = (TextView) findViewById(R.id.answer1); option1.setText(Utility.capitalise(answers.get(0))); TextView option2 = (TextView) findViewById(R.id.answer2); option2.setText(Utility.capitalise(answers.get(1))); TextView option3 = (TextView) findViewById(R.id.answer3); option3.setText(Utility.capitalise(answers.get(2))); TextView option4 = (TextView) findViewById(R.id.answer4); option4.setText(Utility.capitalise(answers.get(3))); int score = currentGame.getscore(); String scr = String.valueOf(score); TextView score1 = (TextView) findViewById(R.id.score); score1.setText(scr); try{ new CountDownTimer(20000,1000) { public void onTick(long millisUntilFinished) { TextView timers = (TextView) findViewById(R.id.timers); timers.setText("" + millisUntilFinished / 1000); } public void onFinish() { currentGame.decrementscore(); processSession(); } }.start(); } catch(Exception ex) { throw new RuntimeException(ex); } } @Override public void onClick(View arg0) { //Log.d("Questions","Moving to next question"); if(arg0.getId()==R.id.answer5) { new AlertDialog.Builder(this).setMessage("Are you sure?").setCancelable(true).setPositiveButton("Yes",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { finish(); } }).setNegativeButton("No",null).show(); } else { if(!checkAnswer(arg0)) return; /** * check if end of game */ if (currentGame.isGameOver()){ //Log.d("Questions","End of game! lets add up the scores.."); //Log.d("Questions","Questions Correct: " + currentGame.getRight()); //Log.d("Questions","Questions Wrong: " + currentGame.getWrong()); Intent i = new Intent(this,EndgameActivity.class); startActivity(i); finish(); } else{ Intent i = new Intent(this,QuestionActivity.class); startActivity(i); finish(); } } } @Override public boolean onKeyDown(int keyCode,KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK : return true; } return super.onKeyDown(keyCode,event); } /** * Check if a checkBox has been selected,and if it * has then check if its correct and update gamescore */ private boolean checkAnswer(View v) { try { final Button b=(Button) v; final String answer = b.getText().toString(); counterTimer.cancel(); b.setBackgroundResource(R.drawable.ans); b.setEnabled(false); //Log.d("Questions","Valid CheckBox selection made - check if correct"); handler.postDelayed(new Runnable() { @Override public void run() { if( (currentQ.getAnswer().equalsIgnoreCase(answer))) { b.setBackgroundResource(R.drawable.ansgreen); //Log.d("Questions","Correct Answer!"); currentGame.incrementscore(); } else{ b.setBackgroundResource(R.drawable.ansred); //Log.d("Questions","Incorrect Answer!"); currentGame.decrementscore1(); } } },10000000); } catch (Exception e) { e.printstacktrace(); } return true; }
任何答案都很明显.
提前致谢
解决方法
private boolean checkAnswer(View v) { Button b=(Button) v; String answer = b.getText().toString(); b.setBackgroundResource(R.drawable.ans); b.setEnabled(false); if (currentQ.getAnswer().equalsIgnoreCase(answer)) { b.setBackgroundResource(R.drawable.ansgreen); } else{ b.setBackgroundResource(R.drawable.ansred); } return true; }
处理器
if (currentGame.isGameOver()){ //Log.d("Questions","Questions Wrong: " + currentGame.getWrong()); final Handler handle = new Handler(); Runnable delay = new Runnable() { public void run() { finish(); startActivity(new Intent(QuestionActivity.this,EndgameActivity.class)); } }; handle.postDelayed(delay,1000); } else { final Handler handle = new Handler(); Runnable delay = new Runnable() { public void run() { finish(); startActivity(new Intent(QuestionActivity.this,QuestionActivity.class)); } }; handle.postDelayed(delay,1000); } }
asp.net – 如何在使用Html.TextAreaFor时更改字体和颜色?
<%= Html.TextAreaFor(m => m.Component.ApplicationDescription,new { cols = "40%",Style = new Style { ForeColor = Color.Red } })%>
解决方法
<%= Html.TextAreaFor(m => m.Component.ApplicationDescription,})%>
或应用CSS风格:
<%= Html.TextAreaFor(m => m.Component.ApplicationDescription,@})%>
这看起来像这样:
.foo { color: red; }
css – 使用引导程序滑出面板
我已经看到nav-collapse效果非常相似,除了它从上面掉下来,只出现在某个屏幕尺寸以下.希望现有的代码可以使用效果
http://codepen.io/Tyriar/pen/nJGfj
可能吗?
谢谢.
解决方法
https://github.com/jakiestfu/Snap.js/
这里有一些有用的实现演示:
http://jakiestfu.github.io/Snap.js/demo/apps/default.html
今天关于css – 如何在使用引导程序激活时更改按钮颜色?和引导样式的讲解已经结束,谢谢您的阅读,如果想了解更多关于AlertDialog更改按钮颜色、android – 如何在点击时更改按钮的颜色并暂停屏幕几秒钟?、asp.net – 如何在使用Html.TextAreaFor时更改字体和颜色?、css – 使用引导程序滑出面板的相关知识,请在本站搜索。
本文标签: