1. 程式人生 > 其它 >設定EditText圖示大小——其他圖示同樣適用

設定EditText圖示大小——其他圖示同樣適用

技術標籤:Androidandroid

        //控制登入使用者名稱圖示大小
        Drawable drawable1 = getResources().getDrawable(R.drawable.yonghu);
        drawable1.setBounds(8, 8, 100, 100);//第一個 0 是距左邊距離,第二個 0 是距上邊距離,40 分別是長寬
        mElf1.setCompoundDrawables(drawable1 , null, null, null);//只放左邊

        //控制登入密碼圖示大小
        Drawable drawable2 =
getResources().getDrawable(R.drawable.mima); drawable2.setBounds(8, 8, 100, 100);//第一個 0 是距左邊距離,第二個 0 是距上邊距離,40 分別是長寬 mElf2.setCompoundDrawables(drawable2 , null, null, null);//只放左邊