Time of Update: 2018-12-05
書接上回 在xml裡建立屬性,然後java代碼裡用typedArray獲得這些屬性,得到屬性後,利用屬性做一些事.例:得到xml裡的color,賦給paint.1.在res/values/下建立attrs.xml<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="CustomView2"> <attr name="textColor"
Time of Update: 2018-12-05
今天遇到在EditText點擊的時候彈不出軟鍵盤,讓他獲得焦點啥的都沒效果後來google+baidu終於解決了,我用的是getSystemService得到的WindowManager ,然後在這個WindowManager 裡加的EditText,改為將EditText嵌套在activity的布局檔案中就可以了,下面是不彈出軟鍵盤的代碼,你出的問題,不一定是WindowManager 也可能是其他的WindowManager manager = (WindowManager)
Time of Update: 2018-12-05
An APN (Access Point Name) is the information needed to establish a GPRS/EDGE/UMTS cellular packet data connection on a mobile device. Usually the device can be configured by the operator, the OEM, and users with an APN address such as wap.cingular
Time of Update: 2018-12-05
構建自訂群組件Android中,你的應用程式程式與View類組件有著一種固定的聯絡,例如按鈕(Button)、文字框(TextView),可編輯文字框(EditText),列表框(ListView),複選框(CheckBox),單選框(RadioButton),捲軸(Gallery),微調器(Spinner), 等等,還有一些比較先進的有著特殊用途的View組件,例如AutoCompleteTextView,ImageSwitcher和 TextSwitcher。除此之外,種類繁多的像
Time of Update: 2018-12-05
因為需求,我需要獲得viewpager當前的view於是我採用以下寫法View currentView = mViewPager.getChildAt(mViewPager.getCurrentItem());然後我拿這個view去做其他的事,但是滑動超過3個view後,再拿這個view的時候發現是null, mViewPager.getCurrentItem()超過2時就是null了, 這說明viewpager是三個view重複利用那怎麼辦呢?轉載請註明出處:http://blog.csdn.
Time of Update: 2018-12-05
在今天的文章中我們將展示如何建立,管理和使用Android中的音效。在第一部分我們將展示基本的封裝與管理聲音有關代碼的方法。這個方法可以正常工作當你有一個典型的應用程式或者單線程的簡單遊戲。在你閱讀完這些之後,可以閱讀第二部分,它將告訴你一個更進階的方式來管理聲音通過其他的類。 我們用來播放聲音的方法利用Sound Pool類而不是Android開發嚮導推薦的Media Player類。當然利用Media Player類實現簡單應用也是可以的,但是這個類不能提供我們所需要的靈活性。
Time of Update: 2018-12-05
先簡單說一下怎樣匯入apidemos,用Eclipse的Juno及以上版本非常簡單,點New--Other選擇Android下面的Android Sample
Time of Update: 2018-12-05
public class contractTest extends Activity { private static final String TAG = "U0fly contractTest ===> "; private static final int PICK_CONTACT = 3; @Override public void onCreate(Bundle savedInstanceState) {
Time of Update: 2018-12-05
上次講的自訂控制項重新整理點螢幕的任意地方都會重新整理,而且在xml裡自訂控制項下面放一個textview的話,這個TextView是顯示不出來的,不只這個,以前的幾個自訂控制項都是為什麼呢?今天來講下onMeasure()在自訂重新整理控制項的基礎上重寫onMeasure方法根據上一篇自訂群組件修改注釋在代碼裡<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-05
在這個檔案下面:frameworks/base/core/res/res/values/config.xml <!-- Component name of the default wallpaper. This will be ImageWallpaper if not specified --><string name="default_wallpaper_component"
Time of Update: 2018-12-05
BitmapFactory需慎用,可能造成oomBitmap bitmap = BitmapFactory.decodeResource(getResources(),
Time of Update: 2018-12-05
歡迎轉帖,但請註明地址:http://blog.csdn.net/ethan_xue/ 謝謝最近因為項目需要,更改EditText被選中時的圖片,網路搜尋未果,於是查看原始碼EditText代碼裡沒什麼東西,於是猜測在其父類TextView中,很快發現這樣一段代碼 int mTextSelectHandleLeftRes; int mTextSelectHandleRightRes; int mTextSelectHandleRes; Drawable
Time of Update: 2018-12-05
本人和朋友們做了一段時間瀏覽器,將一些小技巧分享出來,先寫一部分,慢慢寫,同時也為我們的瀏覽器打打廣告我們的瀏覽器將要上線,名叫沙發瀏覽1.網頁內的右鍵菜單public boolean onLongClick(View view) {// 擷取點擊的元素HitTestResult mResult = mWebView.getHitTestResult();final int type = mResult.getType();switch (type) {case
Time of Update: 2018-12-05
歡迎轉帖,但請註明地址:http://blog.csdn.net/ethan_xue/ 謝謝1. java.net.SocketException: Noroute to host重新開一下wifi就可以了.2.Failed to install xxx.apk on device '040398FE1701701F': Unable to open sync connection!java.io.IOException: Unable to open sync
Time of Update: 2018-12-05
轉自http://www.cnblogs.com/hdjjun/archive/2011/10/12/2209467.html 代碼為自己編寫目標:實現textview和ImageButton組合,可以通過Xml設定自訂控制項的屬性。 通過代碼或者通過xml設定自訂控制項的屬性1.控制項布局:以Linearlayout為根布局,一個TextView,一個ImageButton。 Xml代碼< ?xml version="1.0" encoding="utf-8"?>
Time of Update: 2018-12-05
onFinishInflate() 當View中所有的子控制項 均被映射成xml後觸發onMeasure(int, int) 確定所有子項目的大小onLayout(boolean, int, int, int, int) 當View分配所有的子項目的大小和位置時觸發onSizeChanged(int, int, int, int) 當view的大小發生變化時觸發onDraw(Canvas) view渲染內容的細節onKeyDown(int, KeyEvent)
Time of Update: 2018-12-05
1.Android-Universal-Image-Loaderhttps://github.com/nostra13/Android-Universal-Image-Loader推薦使用,可以在很大程度上避免圖片的oom 2.afinalhttps://github.com/yangfuhai/afinal個人認為bug超多,圖片部分是封裝的google的官網代碼,使用簡便了,但是bug多了,不建議使用,希望作者繼續努力,修複的更好一些ps:作者已更新為軟引用,減少記憶體崩潰,有興趣的童鞋可以
Time of Update: 2018-12-05
轉載請註明地址:http://blog.csdn.net/ethan_xue/article/details/7313788ps: 可根據apidemo裡LableView,list4,list6學習文檔在dev guide/Framework Topics/User Interface/Building Custom Components自訂控制項的步驟:1 View的工作原理 2 編寫View類 3 為View類增加屬性 4 繪製螢幕 5 響應使用者訊息 6
Time of Update: 2018-12-05
將webview裡常用的東西拿出來分享下想要webview載入頁面,只需webView.loadUrl("http://m.baidu.com");當然別忘了添加網路許可權此時點擊網頁裡的超連結,會彈出多個瀏覽器選擇,但是我們想要在自己的瀏覽器開啟,就需要設定WebViewClientwebView.setWebViewClient(new
Time of Update: 2018-12-05
三種得到LinearInflater的方法a. LayoutInflater inflater = getLayoutInflater();b. LayoutInflater localinflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); c. LayoutInflater inflater = LayoutInflater.from(context);onDraw 方法繪圖,