欢迎来到天天文库
浏览记录
ID:38176048
大小:263.78 KB
页数:5页
时间:2019-05-24
《Android记事本》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1.只是在主程序里面添加此代码:TextViewtextView=newTextView(this);textView.setText("你好啊");setContentView(textView);就会在Android虚拟机上显示“你好啊”2.只在Main.xml里面添加代码:3.4.设置超链接:android
2、:autoLink=”all”5.跑马灯:android:singleLine=”true”把所以要跑马灯的都显示成一行android:focusable="true"android:ellipsize="marquee"android:marqueeRepeatLimit="marquee_forever"android:focusableInTouchMode="true"6.设置字体颜色:TextViewtv=(TextView)findViewById(R.id.tv);Stringstr="欢迎
3、大家收看《Android开发从零开始》系列课程,感谢大家的支持。";SpannableStringBuilderstyle=newSpannableStringBuilder(str);style.setSpan(newForegroundColorSpan(Color.RED),0,6,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);style.setSpan(newForegroundColorSpan(Color.GREEN),6,21,Spannable.SPAN_EXCL
4、USIVE_EXCLUSIVE);style.setSpan(newForegroundColorSpan(Color.BLUE),21,26,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);tv.setText(style);7.8.privateAlphaAnimationan1=newAlphaAnimation(1,0);定义他的@动画,是android自带的an1.setDuration(1000);休息的时间问1000毫秒imgv1.startAnimation(an1
5、);//startAnimation启动动画9.给自己的界面设置空间大小Android:layout_weight=”X”10.实现图片的循环a先取得getContext的返回最大值PublicintgetContext(){ReturnInteger.MAX_VALUE;}b有就是设置图片给ImageView对象Imageview.setImageResource(resides[position%resIds.length]);c.我们还可以给图片添加一个边框首先定义一个intmGalleryItem
6、Background;,然后取得Gallery属性的Indexid的值publicImageAdapter(Contextc){mContext=c;//使用在res/value/attrs.xml中的Gallery属性TypedArraya=obtainStyledAttributes(R.styleable.Gallery);//取得Gallery属性的IndexidmGalleryItemBackground=a.getResourceId(R.styleable.Gallery_android_g
7、alleryItemBackground,0);//让对象的styleable属性能够反复使用a.recycle();}在res/value/attrs.xml的代码11.AlertDialog的使用AlertDialog.Builderbuilder=newAlertDialog.Builder(C018_onDo
8、ubleClickActivity.this);builder.setTitle("双击");builder.setMessage("VeryGood");builder.show();图片的淡进淡出:AlphaAnimationaa=newAlphaAnimation(1,0);//1,0从透明到不透明图片的移动:TranslateAnimationta=newTranslateAnimation(Animation.REL
此文档下载收益归作者所有