2010年10月29日 星期五

怎麼在blogger貼程式碼

首先 ,到 SyntaxHighLighter下載檔案
http://alexgorbatchev.com/SyntaxHighlighter/
並找一個空間host裡面的js,css檔案

假設我們存放在xxx.xxx.xxx裡面

登入blogger,並至設定,修改html裡面


<!-- 設定載入 shCore.css 與 shThemeDefault.css --> 
<link href='http://xxx.xxx.xxx/shCore.css' rel='stylesheet' type='text/css'/> 
<link href='http://xxx.xxx.xxx/shThemeDefault.css' rel='stylesheet' type='text/css'/> 
<!-- 設定需要載入的核心檔案 shCore.js --> 
<script src='http://xxx.xxx.xxx/shCore.js' type='text/javascript'/> 
<!-- 設定需要載入的程式語言檔案 --> 
<script src='http://xxx.xxx.xxx/shBrushJScript.js' type='text/javascript'/> 
<script src='http://xxx.xxx.xxx/shBrushSql.js' type='text/javascript'/> 
<script src='http://xxx.xxx.xxx/shBrushVb.js' type='text/javascript'/> 
<script src='http://xxx.xxx.xxx/shBrushXml.js' type='text/javascript'/> 
<!-- 設定啟用 highlighter --> 
<script type='text/javascript'> 
     SyntaxHighlighter.config.bloggerMode = true; 
     SyntaxHighlighter.all()
</script> 


將前述程式碼貼在 <body> 後面
儲存,就算是設定完成了



平時貼程式碼的方法,假設我要貼下列程式碼

function helloSyntaxHighlighter()
{
 return "hi!";
}

就在發表文章中的修改html以下列方式撰寫

<pre class="brush: js;">
function helloSyntaxHighlighter()
{
return "hi!";
}
</pre>

如果你的文字有特殊字元,不要忘記先encode,
http://www.opinionatedgeek.com/dotnet/tools/htmlencode/encode.aspx

Android要怎麼做出透明Activity

首先在
在res/values/中加入一個新的檔案

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.Transparent" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">false</item>
</style>
</resources>


在res/values/中加入一個新的檔案

color.xml


<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="transparent">#00000000</color>
</resources>



最後在AndroidManifest中,Activity設定修改Theme 為 @style/Theme.Transparent

2010年10月20日 星期三

Android儲存在SD卡的圖片要怎麼顯示在相簿

因為相簿預設是在插拔USB時才會檢查有無新的圖片
所以需要手動讓他檢查,在你的程式碼中加入這行

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

 他就會去掃你的SD卡中有無新的圖片

2010年10月18日 星期一

Android webView截圖顯示在imageView上

Picture picture = webView.capturePicture();
int weight = picture.getWidth(); 
int height = picture.getHeight(); 
if (weight > 0 && height > 0){
        Bitmap bitmap = Bitmap.createBitmap(weight, height,
        Bitmap.Config.ARGB_8888);
 Canvas canvas = new Canvas(bitmap);
 picture.draw(canvas);
 mImageView.setImageBitmap(bitmap); 
}

也可以任意的對bitmap作影像處裡達到需要的效果

2010年10月7日 星期四

Seth Priebatsch:世界第一的遊戲社交圈



有很多觀念都是我三年前就有討論過想做的
我有個IDEA誠徵一起做的人XD

2010年10月6日 星期三

CSS3.0 Maker 學習CSS3的好幫手


左邊框可以調整各種參數,中間框可以預覽調整後的樣子,右邊框是程式碼
下方框說明可以支援的瀏覽器