EditText gravity和inputtype同時使用在5.0以下被遮蓋

同時設置了inputType和gravity或者同時設置singleLine和gravity。

?解決辦法一:(不推薦)

????? ? 1、放棄同時使用singleLine和gravity改為使用maxLength 和 gravity;

2、用numeric代替inputtype

解決辦法二:(推薦)

加入以下代碼:

?

final?WindowManager.LayoutParams?attributes?=?getWindow().getAttributes();??

getWindow().getDecorView().addOnLayoutChangeListener(new?View.OnLayoutChangeListener()?{??

@Override??

public?void?onLayoutChange(View?v,?int?left,?int?top,?int?right,?int?bottom,?int?oldLeft,?int?oldTop,?int?oldRight,?int?oldBottom)?{??

???????????????getWindow().setAttributes(attributes);??

???????????}??

???????});??

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容