亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

啟動片段并滾動時鍵盤打開

啟動片段并滾動時鍵盤打開

qq_遁去的一_1 2023-12-13 10:10:55
我的片段中有一個滾動視圖,當片段打開時,鍵盤會自動出現并專注于布局的第一個編輯文本,并且屏幕滾動,在鍵盤打開時我無法看到所有字段。那么,我該怎么做才能防止片段啟動時出現鍵盤,以及如何在打開鍵盤的情況下查看滾動視圖中的所有字段呢?謝謝這是 XML 的一部分<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/personalDataLayout"android:layout_width="match_parent"android:layout_height="match_parent"android:focusable="true"android:focusableInTouchMode="true"tools:context=".presentation.fragments.PersonalDataFragment"><ScrollView    android:layout_width="match_parent"    android:layout_height="match_parent"    android:padding="10dp">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:orientation="vertical">
查看完整描述

1 回答

?
喵喔喔

TA貢獻1735條經驗 獲得超5個贊

可聚焦的最高級別視圖將被聚焦。如果獲得焦點,EditTexts 會拉起鍵盤。但是如果你將以下內容添加到你的父View(RelativeLayout,LinearLayout等)中,那么鍵盤將不會自動打開


android:focusable="true"

android:focusableInTouchMode="true"

例子:


<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

   xmlns:app="http://schemas.android.com/apk/res-auto"

   android:layout_width="match_parent"

   android:focusable="true"

   android:focusableInTouchMode="true"

   android:layout_height="match_parent">


查看完整回答
反對 回復 2023-12-13
  • 1 回答
  • 0 關注
  • 159 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號