超低空飞行 躲避雷达:Android有趣的全透明效果
来源:百度文库 编辑:偶看新闻 时间:2024/04/29 17:33:39
【Android编程之旅】社区活动:写博文获精彩图书! 1.Activity全透明
2.Dialog全透明
Android有趣的全透明效果--Activity及Dialog的全透明(附android系统自带图标大全)
2010-08-18 20:20 6014人阅读 评论(3) 收藏 举报1.Activity全透明
同学zzm给了这个有趣的代码,现在公布出来。
先在res/values下建colors.xml文件,写入:
-
#9000 -
这个值设定了整个界面的透明度,为了看得见效果,现在设为透明度为56%(9/16)左右。
再在res/values/下建styles.xml,设置程序的风格
-
- @color/transparent
-
- true
-
- @+android:style/Animation.Translucent
最后一步,把这个styles.xml用在相应的Activity上。即在AndroidManifest.xml中的任意
- android:theme="@style/transparent"
如果想设置所有的activity都使用这个风格,可以把这句标签语句添加在
最后运行程序,哈哈,是不是发现整个界面都被蒙上一层半透明了。最后可以把背景色#9000换成#0000,运行程序后,就全透明了,看得见背景下的所有东西可以却都操作无效。呵呵....
2.Dialog全透明
1.准备保留边框的全透明素材如下图:
2.在values中新建一styles.xml文件,内容如下:
3.在layout文件夹下新建一文件句为main_dialog.xml,内容如下:
view plain
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="#0000">
- android:layout_width="wrap_content"
- android:layout_height="200px"
- android:layout_below="@+id/ImageView01"
- android:background="#0000">
- android:text="SodinoText"
- android:textColor="#f000"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="#0000"
- >
4.Activity代码如下:
view plain
- 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. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- Button 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.",
- "http://blog.csdn.net/sodino");
- }
- });
- }
- private void showTANC(String header, String content, String url) {
- final Dialog dialog = new Dialog(this, R.style.TANCStyle);
- dialog.setContentView(R.layout.main_dialog);
- dialog.setTitle(header);
- dialog.setCancelable(true);
- TextView textView01 = (TextView) dialog.findViewById(R.id.TextView01);
- textView01.setText(content + content + content);
- Button btnCancel = (Button) dialog.findViewById(R.id.btnCancel);
- btnCancel.setOnClickListener(new Button.OnClickListener() {
- public void onClick(View view) {
- dialog.cancel();
- }
- });
- dialog.show();
- }
- }
最后效果图:
另附 android系统自带图标大全(1.5 1.6 2.1)
http://since2006.com/android/1.5-drawables.php
radiohead 的 Paranoid Android 中文翻译
精液是全透明的?有事吗?
精液是全透明的?有事吗??????
为什么没有全透明的牙齿正畸托槽....
哪里有背景全透明的图片
如何做透明的flash动画效果?
怎么使我的空间全变成透明的?
如何去除QQ空间主页的全透明??
百度空间的CSS代码怎样是页面全透明
透明香皂效果好不好?
娥佩兰的透明感光粉饼效果怎么样?
VIA S3G不能用WB5的透明效果,如何解决
怎么加载博客里的钟表,透明效果
关于photoshop9.0图片透明,朦胧效果的问题
怎么用PS制作渐变式的透明效果
请问MISSHA玫瑰散粉好用吗?希望有自然透明的效果
acid android的menbers除了yuki外谁可以给我介绍一下?
哪里可以下到acid android的歌恳求拜托了我要疯了!!!!
QQ空间全透明代码
急 背景换成全透明
如何设置背景全透明
paranoid android中文歌词
透明flash效果代码是什么?
一个有趣的故事,一个惊人的回答全靠你了