मुझे निम्न लेआउट फ़ाइल मिली है, जिसमें पृष्ठभूमि के रूप में GridView
और ImageView
है।मैं पूरी स्क्रीन का उपयोग करने के लिए ग्रिड व्यू को कैसे मजबूर कर सकता हूं (प्रदर्शन आकार के बावजूद)?
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginRight="-70dp"
android:layout_marginBottom="-50dp"
android:src="@drawable/s_background"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"/>
</LinearLayout>
</FrameLayout>
और यह लेआउट मैं ग्रिड के प्रत्येक "सेल" में वास्तविक आइटम के लिए उपयोग करते हैं:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/cardInGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:singleLine="true"
android:textSize="40sp"
android:textColor="#660099"
android:typeface="serif"/>
</LinearLayout>
मैं इस समय अपने डिवाइस पर निम्नलिखित दिखाई दे रही है:
क्या प्रत्येक आइटम को ग्रिडव्यू में बड़ा बनाने का कोई तरीका है, इसलिए यह स्क्रीन के आकार को फिट करता है और मेरे पास डिस्प्ले के नीचे अन-उपयोग की गई सफेद जगह नहीं है?
यह एक एमुलेटर पर ठीक काम करता है, लेकिन डिवाइस पर स्क्रीन रिज़ॉल्यूशन अधिक होता है, इसलिए नीचे सफेद स्थान प्राप्त होता है।
बहुत धन्यवाद
दिलचस्प बात यह है कि अगर मैं 'एंड्रॉइड: minSdkVersion' को कुछ भी सेट करता हूं, जैसे 6/7/8 मुझे उपरोक्त व्यवहार मिलता है। जिस क्षण मैं इसे पूरी तरह से हटा देता हूं, ग्रिडव्यू अधिक स्क्रीन स्पेस भरता है। कोई विचार? – Jimmy
एस्ले को ग्रिडव्यू के बारे में कोई समाधान मिला है? मुझे एक ही समस्या का सामना करना पड़ रहा है ... –
@parag: क्या आप इस मुद्दे के बारे में मेरी मदद कर सकते हैं ........ –