2015年10月14日 星期三

[Android] set current time


//SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd,HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis()) ; // 獲取當前時間
String now_time = formatter.format(curDate);

reference: http://bibby1101.pixnet.net/blog/post/44759449-%E3%80%8Aandroid%E3%80%8B%E6%8A%93%E5%8F%96%E6%89%8B%E6%A9%9F%E4%B8%8A%E6%99%82%E9%96%93%E8%B3%87%E8%A8%8A


2015年10月6日 星期二

[Android] Text size and different android screen sizes

reference: http://stackoverflow.com/questions/9877946/text-size-and-different-android-screen-sizes


@forcelain I think you need to check this Google IO Pdf for Design. In that pdf go to Page No:77 in which you will find how there suggesting for using dimens.xml for different devices of android for Example see Below structure :
res/values/dimens.xml

res/values-small/dimens.xml

res/values-normal/dimens.xml

res/values-large/dimens.xml

res/values-xlarge/dimens.xml
for Example you have used below dimens.xml in values.
<?xml version="1.0" encoding="utf-8"?>
<resources>
   <dimen name="text_size">18sp</dimen>
</resources>
In other values folder you need to change values for your text size .


other reference:
http://blog.csdn.net/kazeik/article/details/8268721