亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android開發(fā)軟鍵盤遮擋登陸按鈕的完美解決方案

 更新時間:2016年10月14日 14:44:30   作者:poet  
在應用登陸頁面我們需要填寫用戶名和密碼。當填寫這些信息的時候,軟鍵盤會遮擋登陸按鈕,這使得用戶體驗較差。今天小編給大家分享本教程給大家介紹解決android軟鍵盤遮擋登陸按鈕的方法,感興趣的朋友一起學習吧

在應用登陸頁面我們需要填寫用戶名和密碼。當填寫這些信息的時候,軟鍵盤會遮擋登陸按鈕,這使得用戶體驗較差,所以今天就來解決這個問題

1:登陸布局界面如下

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/login_bg" > 
<LinearLayout 
android:id="@+id/ll_center" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" > 
<ScrollView 
android:id="@+id/sl_center" 
android:layout_width="fill_parent" 
android:layout_height="0dp" 
android:layout_weight="1" 
android:fadingEdge="none" 
android:scrollbars="none" > 
<RelativeLayout 
android:id="@+id/rl_center" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" > 
<LinearLayout 
android:id="@+id/sms_login_ll_title" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_centerHorizontal="true" 
android:layout_marginTop="90dip" 
android:orientation="horizontal" > 
<ImageView 
android:id="@+id/sms_login_iv_icon" 
android:layout_width="70dip" 
android:layout_height="70dip" 
android:layout_gravity="center_vertical" 
android:src="@drawable/login_top_icon" /> 
<ImageView 
android:id="@+id/sms_login_iv_big_text" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="center_vertical" 
android:layout_marginLeft="15dip" 
android:src="@drawable/sms_login_icon_big" /> 
</LinearLayout> 
<ImageView 
android:id="@+id/sms_login_iv_name" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_below="@id/sms_login_ll_title" 
android:layout_centerHorizontal="true" 
android:layout_marginTop="28dip" 
android:background="@drawable/sms_login_icon_small" /> 
<RelativeLayout 
android:id="@+id/sms_login_rl_input_name" 
android:layout_width="fill_parent" 
android:layout_height="43dip" 
android:layout_below="@id/sms_login_iv_name" 
android:layout_centerHorizontal="true" 
android:layout_marginLeft="40dip" 
android:layout_marginRight="40dip" 
android:layout_marginTop="40dip" 
android:background="@drawable/login_top_input" > 
<ImageView 
android:id="@+id/sms_login_iv_input_name_icon" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_alignParentLeft="true" 
android:layout_centerVertical="true" 
android:layout_marginLeft="10dip" 
android:layout_marginRight="10dip" 
android:background="@drawable/login_input_icon_user" /> 
<FrameLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_centerVertical="true" 
android:layout_toRightOf="@id/sms_login_iv_input_name_icon" > 
<EditText 
android:id="@+id/sms_login_et_accout" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/transparent_white" 
android:digits="@string/sms_login_accout_text" 
android:hint="請輸入賬號" 
android:singleLine="true" 
android:text="" 
android:textSize="20sp" /> 
</FrameLayout> 
</RelativeLayout> 
<RelativeLayout 
android:id="@+id/sms_login_rl_input_pass" 
android:layout_width="fill_parent" 
android:layout_height="43dip" 
android:layout_below="@id/sms_login_rl_input_name" 
android:layout_centerHorizontal="true" 
android:layout_marginLeft="40dip" 
android:layout_marginRight="40dip" 
android:background="@drawable/login_top_input" > 
<ImageView 
android:id="@+id/sms_login_iv_input_pass_icon" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_alignParentLeft="true" 
android:layout_centerVertical="true" 
android:layout_marginLeft="10dip" 
android:layout_marginRight="10dip" 
android:background="@drawable/login_input_icon_pwd" /> 
<FrameLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_centerVertical="true" 
android:layout_toRightOf="@id/sms_login_iv_input_pass_icon" > 
<EditText 
android:id="@+id/sms_login_et_password" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/transparent_white" 
android:digits="@string/sms_et_change_password_old_text" 
android:hint="請輸入密碼" 
android:inputType="textPassword" 
android:singleLine="true" 
android:text="" 
android:textSize="20sp" /> 
</FrameLayout> 
</RelativeLayout> 
</RelativeLayout> 
</ScrollView> 
<Button 
android:id="@+id/sms_login_bt_confirm" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_below="@id/sms_login_rl_input_pass" 
android:layout_centerHorizontal="true" 
android:layout_marginLeft="40dip" 
android:layout_marginRight="40dip" 
android:layout_marginTop="16dip" 
android:background="@drawable/sms_update_pass_bg_selector" 
android:text="登 錄" 
android:textColor="@color/white" 
android:textSize="20sp" /> 
</LinearLayout> 
</RelativeLayout> 

需要注意的是:

1:層級關系

RelativeLayout-----

LinearLayout----

ScrollView,

Button

2:在AndroidManifest.xml中的該activity配置 Android:windowSoftInputMode="stateHidden|adjustResize"

3:看如下代碼

etAccount = (EditText) this.findViewById(R.id.sms_login_et_accout); 
etAccount.setOnClickListener(this); 
etAccount.setOnTouchListener(new OnTouchListener() { 
@Override 
public boolean onTouch(View v, MotionEvent event) { 
changeScrollView(); 
return false; 
} 
}); 
/** 
* 使ScrollView指向底部 
*/ 
private void changeScrollView(){ 
h.postDelayed(new Runnable() { 
@Override 
public void run() { 
sl_center.scrollTo(0, sl_center.getHeight()); 
} 
}, 300); 
} 
Handler h = new Handler(){ 
public void handleMessage(Message msg) { 
}; 
}; 

以上所述是小編給大家介紹的Android開發(fā)軟鍵盤遮擋登陸按鈕的完美解決方案,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網站的支持!

相關文章

  • Android實現圖片預覽與保存功能

    Android實現圖片預覽與保存功能

    在App開發(fā)中,通常為了省流提高加載速度提升用戶體驗我們通常在列表中或新聞中的插圖都是以縮略圖壓縮過的圖片來進行展示,當用戶點擊圖片時我們再去加載真正像素的大圖讓用戶預覽。本文將利用Flutter實現這一功能,需要的可以參考一下
    2022-04-04
  • Android View教程之自定義驗證碼輸入框效果

    Android View教程之自定義驗證碼輸入框效果

    這篇文章主要給大家介紹了關于Android View教程之自定義驗證碼輸入框效果的相關資料,文中通過示例代碼介紹的非常詳細,對各位Android開發(fā)者們具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧
    2019-05-05
  • 基于Android中獲取資源的id和url方法總結

    基于Android中獲取資源的id和url方法總結

    下面小編就為大家分享一篇基于Android中獲取資源的id和url方法總結,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-02-02
  • Android實現Service獲取當前位置(GPS+基站)的方法

    Android實現Service獲取當前位置(GPS+基站)的方法

    這篇文章主要介紹了Android實現Service獲取當前位置(GPS+基站)的方法,較為詳細的分析了Service基于GPS位置的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-09-09
  • Android開發(fā)實現圓形圖片功能示例

    Android開發(fā)實現圓形圖片功能示例

    這篇文章主要介紹了Android開發(fā)實現圓形圖片功能,涉及Android實現圓形圖片的界面布局與CirImageView組件相關使用操作技巧,需要的朋友可以參考下
    2019-04-04
  • Android實現懸浮窗體效果

    Android實現懸浮窗體效果

    這篇文章主要為大家詳細介紹了Android實現懸浮窗體效果,顯示懸浮窗口,窗口可以拖動,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-12-12
  • Android實現帶圖標的列表對話框

    Android實現帶圖標的列表對話框

    這篇文章主要為大家詳細介紹了Android實現帶圖標的列表對話框,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-12-12
  • 在Android系統(tǒng)中使用gzip進行數據傳遞實例代碼

    在Android系統(tǒng)中使用gzip進行數據傳遞實例代碼

    HTTP協議上的GZIP編碼是一種用來改進WEB應用程序性能的技術,4.4MB的文本數據經過Gzip傳輸到客戶端之后變?yōu)?92KB,壓縮效率極高,下面與大家分享下具體的實現
    2013-06-06
  • Android ViewPager制作新手導航頁(動態(tài)加載)

    Android ViewPager制作新手導航頁(動態(tài)加載)

    這篇文章主要為大家詳細介紹了Android ViewPager制作新手導航頁,了解什么是動態(tài)加載指示器,感興趣的小伙伴們可以參考一下
    2016-05-05
  • Android原生側滑控件DrawerLayout使用方法詳解

    Android原生側滑控件DrawerLayout使用方法詳解

    這篇文章主要為大家詳細介紹了Android原生側滑控件DrawerLayout的使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-12-12

最新評論