原创 wget: command not found

yum -y install wget

原创 TextView設置DrawableLeft

Drawable drawable = getResources().getDrawable(R.mipmap.up); 這一步必須設置,否則無效 drawable.setBounds(0, 0, drawable.getMinimumW

原创 android項目導入v7

將android-sdk\extras\android\support\v7項目導入 記得要將原來項目libs中的v4.jar刪除

原创 android setLayoutParams不起作用

手動添加radiobutton,這樣寫無marginTop效果 RadioGroup.LayoutParams bt_params = new RadioGroup.LayoutParams(ViewGroup.LayoutParams.

原创 ViewTreeObserver的用法

當一個視圖樹的佈局發生改變時,可以被ViewTreeObserver監聽到, 這是一個註冊監聽視圖樹的觀察者(observer),在視圖樹的全局事件改變時得到通知。ViewTreeObserver不能直接實例化,而是通過getViewTr

原创 android studio新建activity後R未自動導入

有沒有遇到過這種情況,新建activity後R文件並沒有自動導入,還得自己手動去導入,怎樣設置呢 打開Setting,把這個勾上 在這兒解釋一下三個選項: Optimize imports on fly:這個其實和快捷鍵Ctrl+S

原创 android.view.WindowManager$BadTokenException: Unable to add window

多種情況 1、在子線程中打開,應放到主線程中 2、參數爲getApplicationContext(),應爲activity 3、activity未加載出來就去顯示,可以延遲顯示:new Handler().postDelayed 4、p

原创 finished with non-zero exit value 1

一直找不到錯誤,後來一個一個刪除res下的文件,刪了attrs後發現不報錯了 然後發小我的自定義屬性少寫了一個format 奇葩錯誤,找了一天 Error:Execution failed for task ':app:proce

原创 android 屬性動畫

ObjectAnimator objectAnimator = ObjectAnimator.ofInt(this,"paddingTop",distance,0).setDuration(500);objectAnimator.addU

原创 android studio找不到Subversion

在C:\Users\Administrator\.AndroidStudio1.2\config中把Subversion刪除了 disabled_plugins.txt表示禁用的插件

原创 CentOS:Error: Nothing to do

[root@localhost CORE]# pwd   (查看當前工作目錄,如果不是第二行顯示的,切換到第二行顯示的目錄)/usr/lib64/perl5/CORE[root@localhost CORE]# cp -R libperl

原创 listview一些知識

1、listview如果不設置setAdapter(),即使添加了headView,依舊不會顯示。 2、如果listview不設置setAdapter(),getCount()一直爲0,如果設置了setAdapter(),則getCoun

原创 關於scrollview的滾動

想要做成的效果:當edittext選中時,整個scrollview全部滾動上去 用scrollTo scrollBy smothScrollTo smothScrollBy都試過 都不起作用 整個佈局是這樣的 這是彈出的

原创 IllegalStateException: Failure saving state: active Fragment has cleared

錯誤如下: E/AndroidRuntime(4908): FATAL EXCEPTION: main E/AndroidRuntime(4908): java.lang.IllegalStateException: Failure

原创 android觸摸事件分發機制

一直對android的分發機制不是非常清楚,這次自己測試一下 先把測試結果貼上來: 默認的傳遞是這樣的: activity dispatchTouchEvent --> viewgroup dispatchTouchEvent -->