0
在我的佈局中,我有一些編輯文本和滾動視圖。問題是當我觸摸編輯文本的軟鍵盤打開,但如果我嘗試向下滾動它不會完全向下滾動。當我嘗試完全向上滾動時,會發生同樣的情況。如果我使用android:windowSoftInputMode =「adjustresize」,我可以完全滾動,但我的鍵盤隱藏底部編輯文本。我也嘗試使用 android:windowSoftInputMode =「adjustspan | adjustresize」但未找到解決方案。滾動視圖無法滾動底部或頂部,而編輯文本軟鍵盤打開
另一個問題是,當用戶嘗試輸入相同的文本時,如果它匹配,但在關閉軟鍵盤時消息沒有以正確的位置附加,則會顯示一些錯誤消息。
其我的佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent" >
<include
android:id="@+id/toolbar"
layout="@layout/toolabar"
android:theme="@style/mycustomtoolbartheme"></include>
<ScrollView
android:id="@+id/scrollView_addproductactivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
>
<LinearLayout
android:id="@+id/activity_add_product"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<Button
android:id="@+id/btn_save_addProductActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:background="@drawable/shape1"
android:text="Save"
android:textColor="#fff" />
<Button
android:id="@+id/btn_view_addProductActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="5dp"
android:background="@drawable/shape1"
android:text="view"
android:textColor="#fff" />
</RelativeLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<AutoCompleteTextView
android:id="@+id/autocomplitePn"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Product Name"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<AutoCompleteTextView
android:id="@+id/autocompliteBn"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Brand Name"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_MN"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Model Num"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_Quantity"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Quantity"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_PPP"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Price per Pice"
android:imeOptions="flagNoExtractUi"
android:inputType="numberDecimal"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<AutoCompleteTextView
android:id="@+id/autocomplitecn"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Country "
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<AutoCompleteTextView
android:id="@+id/autocomplitecolor_name"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Color "
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_ProductSize"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Size"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<AutoCompleteTextView
android:id="@+id/autocompliteDname"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Dealer Name"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_Delleremail"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Dealer Email"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_DellerPhn"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Dealer Phn Num"
android:imeOptions="flagNoExtractUi"
android:inputType="phone"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_Delleradd"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Dealer Add"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/edittext_Dellerfax"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
android:hint="Dealer Fax"
android:imeOptions="flagNoExtractUi"
android:inputType="phone"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
我這個代碼添加到我的清單文件,但沒有辦法找到
<activity
android:name="com.example.oggy.productcatalog.AddProductActivity"
android:windowSoftInputMode="adjustPan"
/>
如果我只使用adjustnothing鍵盤隱藏我的底部編輯文本字段,我也無法向上或向下滾動 –
嘗試使用android:fillViewport =「true」在ScrollView中 –
嘗試刪除isScrollContainer或將其設置爲false android:isScrollContainer = 「假」 –