mixer-a
BlogJava
::
首頁
::
新隨筆
::
聯系
::
聚合
::
管理
posts - 101, comments - 29, trackbacks - 0
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
給我留言
查看公開留言
查看私人留言
隨筆檔案
(101)
2012年8月 (2)
2012年7月 (13)
2012年6月 (6)
2012年5月 (6)
2012年4月 (26)
2012年3月 (16)
2012年2月 (17)
2012年1月 (15)
我的連接
a
iteye
csdn
www.javady.com
www.javady.com
搜索
最新評論
1.?re: android開發我的新浪微博客戶端-登錄頁面UI篇(4.1)[未登錄]
仿真時提示:No Launcher activity found!
--小龍
2.?re: android開發我的新浪微博客戶端-登錄頁面UI篇(4.1)[未登錄]
“新建名LoginActivity.java的Activity并且在AndroidManifest.xml中進行相應配置”請問怎么進行配置?因為新建的LoginActivity.java無法啟動仿真。
--小龍
3.?re: JS 時間處理和格式轉換
@Wanlic2008
不用把時間的年份拿出來單獨分析
--Wanlic2008
4.?re: JS 時間處理和格式轉換
評論內容較長,點擊標題查看
--Wanlic2008
5.?re: Android進階2之Http連接GET/POST請求
有用
--許大海
閱讀排行榜
1.?JS 時間處理和格式轉換(41185)
2.?Android進階2之Activity之間數據交流(onActivityResult的用法)(11501)
3.?[原]Android應用程序發送廣播(sendBroadcast)的過程分析(7302)
4.?[原]Android應用程序鍵盤(Keyboard)消息處理機制分析(4899)
5.?并行計算框架的Java實現--系列一(3785)
評論排行榜
1.?你想不到的壓縮方法:將javascript文件壓縮成PNG圖像存儲(4)
2.?MyEclipse快捷鍵設置(4)
3.?開發流程那些事:6天時間修改1行代碼(3)
4.?JS 時間處理和格式轉換(3)
5.?也談 GET 和 POST 的區別(2)
Android學習筆記進階19之給圖片加邊框
//設置顏色 public void setColour(int color){ co = color; } //設置邊框寬度 public void setBorderWidth(int width){ borderwidth = width; }
具體實現:
package xiaosi.imageborder; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; public class ImageBorderActivity extends Activity { /** Called when the activity is first created. */ private myImageView image = null; private myImageView image1 = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); image = (myImageView)findViewById(R.id.iamge); image.setColour(Color.YELLOW); image.setBorderWidth(10); image1 = (myImageView)findViewById(R.id.iamge1); image1.setColour(Color.GREEN); image1.setBorderWidth(5); } }
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/playerbackground" android:layout_width="fill_parent" android:layout_height="fill_parent"> <xiaosi.imageborder.myImageView android:id="@+id/iamge" android:layout_width="200px" android:layout_height="230px" android:layout_alignParentRight="true" android:src="@drawable/v" android:layout_centerInParent="true" android:layout_marginRight="3px" /> <xiaosi.imageborder.myImageView android:id="@+id/iamge1" android:layout_width="200px" android:layout_height="230px" android:layout_alignParentRight="true" android:src="@drawable/v" android:layout_centerInParent="true" android:layout_marginRight="3px" /> </LinearLayout>
package xiaosi.imageborder; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.widget.ImageView; public class myImageView extends ImageView { private int co; private int borderwidth; public myImageView(Context context) { super(context); } public myImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public myImageView(Context context, AttributeSet attrs) { super(context, attrs); } //設置顏色 public void setColour(int color){ co = color; } //設置邊框寬度 public void setBorderWidth(int width){ borderwidth = width; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // 畫邊框 Rect rec = canvas.getClipBounds(); rec.bottom--; rec.right--; Paint paint = new Paint(); //設置邊框顏色 paint.setColor(co); paint.setStyle(Paint.Style.STROKE); //設置邊框寬度 paint.setStrokeWidth(borderwidth); canvas.drawRect(rec, paint); } }
源代碼下載:
點擊打開鏈接
posted on 2012-02-18 08:20
mixer-a
閱讀(1028)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright ©2025 mixer-a
主站蜘蛛池模板:
利津县
|
新源县
|
河津市
|
黄陵县
|
东乌
|
大理市
|
竹溪县
|
城市
|
泉州市
|
宁河县
|
麻江县
|
司法
|
永嘉县
|
黔江区
|
崇左市
|
钟山县
|
邮箱
|
台北县
|
疏勒县
|
尚义县
|
巴楚县
|
高陵县
|
应城市
|
孙吴县
|
赤峰市
|
满城县
|
澎湖县
|
保山市
|
保靖县
|
林西县
|
东兰县
|
晋城
|
广东省
|
巴马
|
资兴市
|
繁峙县
|
黎川县
|
广安市
|
西乡县
|
奉贤区
|
桃源县
|