मैं अपने Android एप्लिकेशन में बल्कि एक सरल प्रवेश पृष्ठ एक शीर्षक, उपयोगकर्ता नाम TextView, पासवर्ड TextView, लॉग इन बटन और एक छवि पाद लेख युक्तएंड्रॉइड के यूआई में बदलाव से कैसे बचें, जब कीबोर्ड चालू हो या अभिविन्यास बदल जाए?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff" >
<!-- Header Starts -->
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
>
<!-- Logo Start -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:src="@drawable/header" />
<!-- Logo Ends -->
</LinearLayout>
<!-- Header Ends -->
<!-- Footer Start -->
<LinearLayout android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="90dip"
android:layout_alignParentBottom="true"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:src="@drawable/footer" />
</LinearLayout>
<!-- Footer Ends -->
<!-- Login Form -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip"
android:layout_below="@+id/header"
>
<!-- Application Name Label -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:gravity="center"
android:padding="10dip"
android:textSize="25dp"
android:textStyle="bold"
/>
<!-- Username Label -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="User Name"
android:textColor="#372c24" />
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:singleLine="true" />
<!-- Password Label -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Password"
android:textColor="#372c24" />
<EditText
android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:password="true"
android:singleLine="true" />
<!-- Login button -->
<Button
android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="Logon" />
</LinearLayout>
<!-- Login Form Ends -->
</RelativeLayout>
</ScrollView>
मैं दो समस्याएं हैं मैं से संबंधित हैं लगता है:
- जब कीबोर्ड चालू होता है, और मैं नीचे स्क्रॉल करता हूं, तो मुझे लगता है कि छवि फूटर इसके नीचे रहने के बजाय लॉगिन बटन के पीछे "छिपा" है।
- वही तब हो रहा है जब स्क्रीन क्षैतिज रूप से उन्मुख हो।
बातें मैं कोशिश की है: गतिविधि android:windowSoftInputMode="adjustPan"
में
- सेटिंग, लेकिन मैं जब कीबोर्ड दिखाई नीचे स्क्रॉल करने में सक्षम होना चाहते हैं, या
android:windowSoftInputMode="adjustResize"
, या उस बात के लिए किसी अन्य परम। - बटन में
marginBottom
सेट करना।
न तो काम किया। मैं किसी भी मदद की सराहना करता हूं।
क्या आपका मतलब यह भी था कि मुझे कॉन्फ़िगरेशन चेंज विधि में कुछ लिखना चाहिए? क्योंकि मुझे नहीं पता कि कॉन्फ़िगरेशन कब बदला जाता है .. और केवल आपके सुझाव को लिखना काम नहीं करता है ... धन्यवाद – MichalK