Time of Update: 2018-12-03
1.
Time of Update: 2018-12-03
問題1. 運行Activity的時候出現Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'添加Layout的時候,xml跟元素選擇TabHost, 但是ADT沒有添加id屬性, 啟動並執行時候,會提示Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'錯誤, 需要添加android:id="@
Time of Update: 2018-12-03
今天看了一篇介紹FragmentActivity的文章,模仿做了一下.。MainActivity:package com.tao.test;import android.os.Bundle;import android.app.Activity;import android.app.LocalActivityManager;import android.app.TabActivity;import android.content.Intent;import
Time of Update: 2018-12-03
在Android 3.0中新增的行事曆檢視控制項可以顯示網格狀的日曆內容,android.widget.CalendarView是從android.widget.FrameLayout中繼承。CalendarView 類提供了基本的日曆設定方法,long getDate() 擷取從1970年,1月1日,0點0分0秒到現在的毫秒數,因為返回是long型最終只能截止到2038年int getFirstDayOfWeek()
Time of Update: 2018-12-03
今天在項目中遇到將返回的Uri類型轉換成File。將其寫成一個方法:private File uri2File(Uri uri) {File file = null;String[] proj = { MediaStore.Images.Media.DATA };Cursor actualimagecursor = getActivity().managedQuery(uri, proj, null,null, null);int actual_image_column_index =
Time of Update: 2018-12-03
SlidingDrawer類使用的時候主要包括兩點:1:handle:單擊的按鈕2:content:抽屜中的內容,單擊按鈕時,抽屜的內容隱藏或顯示:<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
Time of Update: 2018-12-03
在開發Android移動用戶端的時候往往要使用多線程來進行操作,我們通常會將耗時的操作放在單獨的線程執行,避免其佔用主線程而給使用者帶來不好的使用者 體驗。但是在子線程中無法去操作主線程(UI線程),在子線程中操作UI線程會出現錯誤。因此android提供了一個類Handler來在子線程中來更新UI線程,用發訊息的機制更新UI介面,呈 現給使用者。這樣就解決了子線程更新UI的問題。但是費時的任務操作總會啟動一些匿名的子線程,太多的子線程給系統帶來巨大的負擔,隨之帶來一些效能問題。
Time of Update: 2018-12-03
+-------------------------------------------------++ 本系列為連載,不定期會更新
Time of Update: 2018-12-03
EditText是我們最常用的控制項之一,怎麼用早就知道了,但是怎麼用好,今天就遇到了問題,現在特別總結一下,防止以後再遇到這樣的問題<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="left|top" android:inputType="textMultiLine"
Time of Update: 2018-12-03
++++++++++++++++++++++++++++++++++++++++++本文系本站原創,歡迎轉載! 轉載請註明出處:http://blog.csdn.net/mr_raptor/article/details/7539978++++++++++++++++++++++++++++++++++++++++++ Android編譯系統詳解(一):http://blog.csdn.net/mr_raptor/article/details/7539978
Time of Update: 2018-12-03
1、Android 擷取本機Mac 地址方法:需要在AndroidManifest.xml檔案中添加許可權: <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> public String getLocalMacAddress() { WifiManager wifi = (WifiManager)
Time of Update: 2018-12-03
編譯Android源碼關於android系統的編譯,Android的官方網站上也給出了詳細的說明。http://source.android.com/source/building.html Ø 初始化編譯環境切換到Android源碼目錄:$ cd WORKING_DIRECTORY執行下面命令,載入編譯過程中用到的命令、環境變數:$ source build/envsetup.shØ 選擇編譯選項執行下面的命令,從列表中選擇一個編譯項:$ lunchYou're building on
Time of Update: 2018-12-03
今天項目中要用到對話方塊浮層顯示,PopupWindow可以實現該功能。可以自訂view,通過LayoutInflator方法載入自訂的布局。而且載入和退出時都可以自訂動畫效果。還能指定顯示的位置。如下所示:MainActivity代碼:package com.example.popwindow;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import
Time of Update: 2018-12-03
今天裝了個Android Studio試試,安裝完成後卻打不開。我的作業系統是32位的,Android Studio同事用的64位系統就沒問題。進入命令列執行 android-studio\bin 目錄下的studio.bat提示Unrecognized VM option '+UseCodeCacheFlushing' Could not create the Java virtual machine也就是不能建立虛擬機器。用文本工具開啟studio.batline25 to line 28:
Time of Update: 2018-12-03
做項目的時候用到fragment,在fragment快速切換的時候發生了異常:IllegalStateException: Can not perform this action after onSaveInstanceStatelogcat的提示資訊: Caused by: java.lang.IllegalStateException: Can not perform this action after
Time of Update: 2018-12-03
代碼:package com.example.test;import android.os.Bundle;import android.app.Activity;import android.graphics.Matrix;import android.graphics.PointF;import android.util.FloatMath;import android.view.Menu;import android.view.MotionEvent;import android.view.
Time of Update: 2018-12-03
Android系統支援sqlite資料庫,這給我們的使用帶來了很大的方便。但使用Android系統訪問sqlite資料庫時,有時可能會遇到android.database.sqlite.SQLiteException: database is
Time of Update: 2018-12-03
做項目的碰到這麼一個問題:自己定義的GridView的adapter在重新整理資料,即調用getView方法時,除了調用正常次數(圖中第2條到第8條)的getView,還會多調用1次getView方法(圖中的第1條)。原因在於GridView的item的layout中android:layout_height定義為wrap_content ,
Time of Update: 2018-12-03
最近在做項目的時候要往資料庫中插入很多城市,而android中不支援一次插入多條資料。把sql語句粘到一個txt檔案中。然後通過一行一行的讀檔案來一條條插入。讀取檔案的代碼:public static String getString(int filePath) { Resources res = context.getResources(); InputStream in = null;
Time of Update: 2018-12-03
發送端介面:Bundle bundle = new Bundle();bundle.putString("introduce", "啊啊啊啊啊");Message message = CompletePartnerInformationFragment.completePartnerInfHandler.obtainMessage();message.what =