国产操作系统生态圈推动信息安全与技术自主发展的新机遇
972
2022-10-13
Android有趣的全透明效果--Activity及Dialog的全透明3(转载)
4.Activity代码如下:
lain
package lab.sodino.tanc;import android.app.Activity;import android.app.Dialog;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.TextView;public class TANCAct extends Activity {/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);btnShow = (Button) findViewById(R.id.btnShow);btnShow.setOnClickListener(new Button.OnClickListener() {public void onClick(View view) {showTANC("This is my custom dialog box","TextContent/nWhen a dialog is requested for the first time, Android calls onCreateDialog(int) from your Activity, which is where you should instantiate the Dialog. This callback method is passed the same ID that you passed to showDialog(int). After you create the Dialog, return the object at the end of the method.",}});}private void showTANC(String header, String content, String url) {dialog = new Dialog(this, R.style.TANCStyle);dialog.setContentView(R.layout.main_dialog);dialog.setTitle(header);dialog.setCancelable(true);textView01 = (TextView) dialog.findViewById(R.id.TextView01);textView01.setText(content + content + content);btnCancel = (Button) dialog.findViewById(R.id.btnCancel);btnCancel.setOnClickListener(new Button.OnClickListener() {public void onClick(View view) {dialog.cancel();}});dialog.show();}}
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~