Eros Live
          Find the Way
          posts - 15,comments - 0,trackbacks - 0

          在manifest的activity節(jié)點(diǎn)使用

          <activity android:windowSoftInputMode="adjustResize" . . . >

          當(dāng)點(diǎn)擊EditText控件彈出軟鍵盤(pán)的時(shí)候,系統(tǒng)會(huì)自動(dòng)調(diào)整控件的位置。

          代碼

          http://github.com/shaobin0604/miscandroidapps/tree/master/WindowSoftInputMode/

          參考

          posted @ 2010-08-25 18:42 Eros 閱讀(271) | 評(píng)論 (0)編輯 收藏

          AppWidget的初始化有兩種方式:

          1. 沒(méi)有提供Configure Activity, 則在 AppWidgetProvider#onUpdate 里初始化。
          2. 提供Configure Activity, 則在 Configure Activity 里初始化。

          目前遇到的問(wèn)題是:

          在Launcher里可以預(yù)先配置桌面顯示的AppWidget,如果AppWidget有Configure Activity,則系統(tǒng)在AppWidget的初始化過(guò)程不會(huì)發(fā)送android.appwidget.action.APPWIDGET_CONFIGURE Intent,而只是加載appwidget-provider里配置的initialLayout。這樣第二種就不可用,只能用第一種方法。

          posted @ 2010-08-24 11:11 Eros 閱讀(431) | 評(píng)論 (0)編輯 收藏

          1.字體大小

          synchronized void
          setTextSize(WebSettings.TextSize t)

          Set the text size of the page.

          2.縮放比例

          void
          setSupportZoom(boolean support)

          Set whether the WebView supports zoom

          void
          setInitialScale(int scaleInPercent)

          Set the initial scale for the WebView.

          boolean
          zoomIn()

          Perform zoom in in the webview

          boolean
          zoomOut()

          Perform zoom out in the webview

          3.縮放控件

          void
          setBuiltInZoomControls(boolean enabled)

          Sets whether the zoom mechanism built into WebView is used.

          4.JavaScript支持

          synchronized void
          setJavaScriptEnabled(boolean flag)

          Tell the WebView to enable javascript execution.

          posted @ 2010-07-28 12:49 Eros 閱讀(388) | 評(píng)論 (0)編輯 收藏

          在程序里備份恢復(fù)數(shù)據(jù)

          public static boolean backupDatabase() {
              File dbFile = new File(Environment.getDataDirectory() + "/data/" + PKG + "/databases/" + DB_NAME);
           
              File exportDir = new File(Environment.getExternalStorageDirectory(), "pocket-voa");
              
              if (!exportDir.exists()) {
                  exportDir.mkdirs();
              }
              
              File file = new File(exportDir, dbFile.getName());
           
              try {
                  file.createNewFile();
                  copyFile(dbFile, file);
                  return true;
              } catch (IOException e) {
                  Log.e(TAG, "[backupDatabase] error", e);
                  return false;
              }
          }
           
          public static boolean restoreDatabase() {
              File dbFile = new File(Environment.getDataDirectory() + "/data/" + PKG + "/databases/" + DatabaseHelper.DB_NAME);
           
              File exportDbFile = new File(Environment.getExternalStorageDirectory() + "/pocket-voa/" + DatabaseHelper.DB_NAME);
              
              if (!exportDbFile.exists())
                  return false;
           
              try {
                  dbFile.createNewFile();
                  copyFile(exportDbFile, dbFile);
                  return true;
              } catch (IOException e) {
                  Log.e(TAG, "[restoreDatabase] error", e);
                  return false;
              }
          }
           
          private static void copyFile(File src, File dst) throws IOException {
              FileChannel inChannel = new FileInputStream(src).getChannel();
              FileChannel outChannel = new FileOutputStream(dst).getChannel();
              try {
                  inChannel.transferTo(0, inChannel.size(), outChannel);
              } finally {
                  if (inChannel != null)
                      inChannel.close();
                  if (outChannel != null)
                      outChannel.close();
              }
          }

          參考

          posted @ 2010-07-26 17:24 Eros 閱讀(343) | 評(píng)論 (0)編輯 收藏

           

          There are certain events that Android does not want to start up new processes for, so the device does not get too slow from all sorts of stuff all having to run at once. ACTION_SCREEN_ON is one of those. See this previous question for light blue advice on that topic.

          So, you need to ask yourself, "Self, do I really need to get control on those events?". The core Android team would like it if your answer was "no".

          posted @ 2010-07-22 19:59 Eros 閱讀(1175) | 評(píng)論 (0)編輯 收藏
               摘要: 1.海詞 http://api.dict.cn/ws.php?utf8=true&q=#{word} 返回格式XML<?xml version="1.0" encoding="UTF-8" ?> <dict> <key>word</key> <lang>ec</lang> <audio>...  閱讀全文
          posted @ 2010-07-15 15:45 Eros 閱讀(2036) | 評(píng)論 (0)編輯 收藏
          主站蜘蛛池模板: 石渠县| 陇南市| 敖汉旗| 天全县| 石景山区| 富民县| 金溪县| 江川县| 清水河县| 永靖县| 元氏县| 东至县| 阳新县| 绥阳县| 类乌齐县| 彰化县| 墨竹工卡县| 高唐县| 云阳县| 会理县| 平乐县| 玉山县| 涞水县| 天峻县| 安仁县| 安徽省| 府谷县| 安溪县| 桓仁| 凯里市| 奈曼旗| 即墨市| 平利县| 修水县| 武功县| 新源县| 互助| 佛冈县| 仪陇县| 弥渡县| 独山县|