मेरा एंड्रॉइड ऐप की मुख्य गतिविधि इस तरह दिखती है:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:orientation="vertical"
android:paddingLeft="60dp"
android:paddingTop="53dp" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/billAmountText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/billAmount_string"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/billAmount"
android:layout_width="173dp"
android:layout_height="wrap_content"
android:layout_below="@id/billAmountText"
android:layout_marginTop="3dp"
android:inputType="numberDecimal" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
यह सुनिश्चित करने के लिए कि पृष्ठभूमि छवि (पहले रिलेवेटिवआउट में परिभाषित) कुंजीपटल पॉप अप होने पर निचोड़ा नहीं जाता है, मैंने सेट किया है android:windowSoftInputMode="stateVisible|adjustPan
मेरी गतिविधि के लिए मैनिफेस्ट फ़ाइल में। पृष्ठभूमि और लेआउट के साथ अब सब कुछ अच्छा है, कुछ भी आकार बदल जाता है।
लेकिन समस्या यह है कि मेरा स्क्रॉलव्यू "टी नहीं हैअब काम करें क्योंकि मुझे लगता है कि सिस्टम सोचता है कि विंडो को मैनिफेस्ट में मेरे उपरोक्त संशोधन के कारण आकार बदलने की आवश्यकता नहीं है - इसलिए स्क्रॉलव्यू सक्रिय नहीं है। विपरीत होता है जब मैं लेता हूं android:windowSoftInputMode="stateVisible|adjustPan
बाहर, स्क्रॉलिंग काम करता है, लेकिन कुंजीपटल पॉप आउट होने पर पृष्ठभूमि निचोड़ जाती है।
क्या इसे कोड करने का कोई तरीका है ताकि मेरी पृष्ठभूमि निचोड़ न जाए, और मेरा स्क्रॉलव्यू अभी भी काम करता है? धन्यवाद!
उत्तर:
जवाब के लिए 3 № 1अपनी गतिविधि में संपत्ति का उपयोग करने की कोशिश करें windowSoftInputMode
निम्नलिखित मानों के साथ:
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
मुझे नहीं पता कि यह आवश्यक है या नहीं, लेकिन आप अपने लेआउट में जोड़ने का प्रयास कर सकते हैं ScrollView
टैग करें fillViewPort
सेवा मेरे true
। तो यह मुझे नीचे दिखाए गए कुछ जैसा दिखना चाहिए:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!-- Other Views -->
</ScrollView>
मुझे अपनी प्रगति के बारे में बताएं।
उत्तर № 2 के लिए 1
अपने स्क्रॉलव्यू में एक रिश्तेदार लेआउट, बच्चे 0 डाल दियाएक छविदृश्य है, और बच्चा 1 आपकी सामग्री है। स्क्रॉलव्यू की पृष्ठभूमि की बजाय अपनी पृष्ठभूमि छवि (src) के लिए छविदृश्य का उपयोग करें। इमेजव्यू स्केल टाइप्स का सम्मान करेगा, जबकि लेआउट की पृष्ठभूमि नहीं होगी।