搜尋此網誌

顯示具有 Textview 標籤的文章。 顯示所有文章
顯示具有 Textview 標籤的文章。 顯示所有文章

2014年10月27日 星期一

【Android】android:typeface

Android字型改變,利用TextView內的setTypeface來指定使用字型,但必須透過外部資源assets,引用外部的字體(True Type Font),藉由Typeface類別的createFromAsset方法,讓TextView透過setTypeface來改變字型。

  1. Step1.在/res中,建立fonts資料夾
  2. 將外部字型檔放在fonts資料夾內(字型檔必須是 .ttf )

ref:
Victoria IT Journal

2014年10月18日 星期六

【Android】Textview刪除線實作

在TextView上加入刪除線

方法如下
TextView textview = (TextView) findViewById(R.id.textview1);
Paint paint = textview.getPaint();
paint.setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
paint.setAntiAlias(true);


轉回來
TextView textview = (TextView) findViewById(R.id.textview1);
Paint paint = textview.getPaint();
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
paint.setAntiAlias(true);

參考網址:
http://jiun-blog.blogspot.tw/2012/06/android-textview-line-through.html