- Sep 13 Tue 2016 17:22
Servlet上傳後開始重複執行.library add
- Sep 13 Tue 2016 17:14
伺服器資料庫
- Aug 30 Tue 2016 23:34
java使用poi 讀寫excel
- Aug 29 Mon 2016 17:31
android sqlite vs excel
- Aug 25 Thu 2016 16:36
eclipse to google cloud
下載Tomcat 把環境變數->系統變數 增加名稱: CATALINA_HOME 、值:Tomcat路徑
- Aug 05 Fri 2016 12:07
android系統層介面
WindowManager windowManager = null;//系統層
WindowManager.LayoutParams params = null;//排版 params = new WindowManager.LayoutParams(//排版設定 WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
params.width = WindowManager.LayoutParams.MATCH_PARENT;//物件layout的寬 params.height = 60; params.gravity = Gravity.TOP;//物件layout的位子 titleBG = new ImageView(this);//物件init titleBG.setBackgroundColor(Color.parseColor("#501f2424"));//物件設定圖片及顏色 windowManager.addView(titleBG, params);//將物件及排版加入windowManager
- Jul 29 Fri 2016 14:38
剛開啟app時會有白黑屏
<application
android:theme="@style/translucent">
</application>
//背景透明
<style name="translucent" parent="@android:style/Theme.Translucent"> <item name="android:windowNoTitle">true</item> </style>
//背景設定一張圖片
- Jul 20 Wed 2016 16:02
audio錄音
<manifests.xml> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
private MediaPlayer player; private MediaRecorder recoder; private String filePath = Environment.getExternalStorageDirectory()+"/recoder.3gpp";//儲存位置 <button觸發> public void start(View v) throws IOException { if(player != null) player.release(); File outFile = new File(filePath); if(outFile.exists()) outFile.delete(); recoder = new MediaRecorder(); recoder.setAudioSource(MediaRecorder.AudioSource.MIC); recoder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recoder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recoder.setOutputFile(filePath); recoder.prepare(); recoder.start(); } public void stop(View v){ if(recoder != null) recoder.stop(); }
- Jul 20 Wed 2016 15:55
android 開機接收廣播
<AndroidManifest.xml> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
<receiver android:name=".className"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"></action> </intent-filter> </receiver>
<.java>
public class className extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { } }
- May 26 Thu 2016 18:03
textview scroll
.xml <TextView android:scrollbars = "vertical"/>
程式碼:
private int pageIndex = 0 ;
private TextView text;
text = (TextView) findViewById(R.id.text); text.setMovementMethod(new ScrollingMovementMethod(){ @Override public boolean onKeyDown(TextView widget, Spannable text, int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_DPAD_DOWN){// nextText(); return false; }else if(keyCode == KeyEvent.KEYCODE_DPAD_UP){ preText(); return false; } return super.onKeyDown(widget, text, keyCode, event); } });
private void nextText(){ if(pageIndex == 0){ image.setVisibility(View.GONE); text.scrollTo(0, text.getLayout().getLineTop(行數* (pageIndex+1))); pageIndex++; }else if(text.canScrollVertically(1)){ text.scrollTo(0, text.getLayout().getLineTop(行* (pageIndex+1))); pageIndex++; } }