2013年11月8日 星期五
Android override dialog onBackpressed()
dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK &&
event.getAction() == KeyEvent.ACTION_UP &&
!event.isCanceled()) {
//do something here
return true;
}
return false;
});
Android EditText 自動彈出鍵盤
//先取得focus
edittext.requestFocus();
//強制呼叫鍵盤
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
//若EditText元件是在dialog中則dialog.getWindow()
dialog.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
2013年11月7日 星期四
Android Toast 位置
預設水平置中 重直置底
可用setGravity改變位置
toast.setGravity(gravity, xOffset, yOffset)
//水平置中 重直置頂
Toast toast=Toast.makeText(myactivity,mysentence, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
2013年11月6日 星期三
Android using html on string.xml
- string.xml
<string name="myHtmlString">
<Data><![CDATA[
<font size="2">
2013/11/08<br>
<ul>
<li><font color="0000FF">Ver. 0.99</font></li>
</ul>
</font>
]]> </Data>
</string>
- 程式,使用WebView來秀Html
WebView wv_myHtmlString=(WebView)d.findViewById(R.id.myHtmlString);
wv_myHtmlString.loadDataWithBaseURL(null,
getResources().getString(R.string.myHtmlString),
"text/html", "utf-8",
null);
- 結果如下
2013/11/8
- Ver.0.99
Android Dialog no title, transparent background 無標題 背景透明
final Dialog dialog = new Dialog(your_context);
//設成無標題,此行要在setContentView之前
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.your_dialog_layout);
//設成背景透明
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
//設成無標題,此行要在setContentView之前
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.your_dialog_layout);
//設成背景透明
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
2013年11月2日 星期六
Android set Large, Medium, small text size programmatically
TextView tv=new TextView(this);
tv.setTextAppearance(this, android.R.style.TextAppearance_Medium);
2013年11月1日 星期五
Android 讓ViewPager滑動順暢 setOffscreenPageLimit
最簡單的做法
mViewPager.setOffscreenPageLimit(7);
會佔存7個頁面,不會因為滑出螢幕後頁面就消失
當然,如果頁面佔存設太多會out of memory喔,要自己評估一下
Android 更改ViewPager文字字體顏色,背景顏色
- static
直接改XML Layout <android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#ffffff"
android:textColor="@color/Gray_Font" />
- programmatically
先取出PagerTitleStripPagerTitleStrip pagerTabStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
文字字體顏色
pagerTabStrip.setTextColor(getResources().getColor(R.color.Gray_Font));
背景顏色
pagerTabStrip.setBackgroundResource(resid)
pagerTabStrip.setBackgroundDrawable(background)
pagerTabStrip.setBackgroundColor(color)
2013年10月24日 星期四
Scroll Memo Note Widget
Scroll Memo Note Widget
製作這個widget的理念很簡單,就是在桌面放note
①桌面note常有的毛病,文字太長就看不到完整的文句了。無法下拉觀看!
提供下拉觀看, 文章再長也不怕惹~2013年10月11日 星期五
CashFlow 記帳管理
收入/支出 記帳管理
①圖表能一次綜觀所有的過往金額變化,懶得切換年/月/日觀看圖表,希望一次看完過往金額變化 。
除了了解總金額變化之外,也希望能了解花錢的速度,因此也做了一個對應的收/支速率的綜觀圖。②記帳是為了能過更好的生活,盲目無目標的記流水帳久了就沒記帳的動力了,所以設計了一個目標系統,每次有收入時就先分配一些金額到你的目標,剩下的才拿來日常花費,也就是告訴自己有收入先存錢啦^^。
③ 目標與預算,提供 週、月、年的預算設定。
④ 為了了解自己亂花錢的浪費情形是否有改善,做了類別各單項目的圖表追蹤,看自己的花費是否有改善。
⑤其它一些貼心的隱藏小設計,有待使用者自己發現囉 ♥(˘⌣˘ C)
例如:記帳選類別時,每次都要找類別在哪裡啊很煩呀,我很懶,因此設計了類別會自動聰明的把你最常用的一些項目放到最前面呦!⑥另外,一般記帳的功能也是應有盡有呦!
帳戶管理 / 週期記帳 / 幣別設定 / 啟動密碼 / 備份還原 / 匯出CSV / 更換佈景主題 ...等等功能。
帳戶 / 幣別 / 類別 設定
更換主題顏色
希望大家都能快樂的記帳呦 ヽ(•‿•)ノ
訂閱:
文章 (Atom)