मैं अपने कस्टम बटन पर पृष्ठभूमि छवियों को सेट कर रहा हूं। मैंने अपने ऐप के लिए एक स्क्रीनशॉट बनाया और बताया कि जब मैं बटन की चौड़ाई और ऊंचाई के लिए "wrap_content" का उपयोग कर रहा हूं, तो बटन बढ़ाया जाता है। जब मैं डीपी में आकार तय कर रहा हूं, तो यह अच्छा दिखाई देगा (उदा: मेरे एमडीपीआई फ़ोल्डर में मेरे पास 48x48px आइकन हैं, इसलिए मैंने चौड़ाई और ऊंचाई में 48 डीपी लगाया)। क्या आप कृपया मुझे समझा सकते हैं क्यों?बटन पृष्ठभूमि छवियों को बढ़ाया गया (wrap_content या डीपी उपयोग)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/definition_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp"
android:layout_alignParentTop="true" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<Button
android:id="@+id/addToFavorites"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/favorites_button" />
<Button
android:id="@+id/fontup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/fontup_button" />
<Button
android:id="@+id/fontdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/fontdown_button" />
<Button
android:id="@+id/comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/comment_button" />
<Button
android:id="@+id/speak"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/speak_button" />
</LinearLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/buttons">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<WebView
android:id="@+id/webView1"
android:layout_below="@id/image_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
उपरोक्त कोड मेरी XML फ़ाइल दिखाता है। आप अपनी समस्या के लिए एक स्क्रीनशॉट देखने के लिए इस लिंक पर देख सकते हैं: https://www.dropbox.com/s/phnxt5p335ltqef/buttons_icon_altered.png
वे मेरे सैमसंग गैलेक्सी टैब 10 पर अच्छा लग रहे हैं।1 टैबलेट (एमडीपीआई स्क्रीन होने पर), लेकिन जब मैं एक ही मोबाइल एप्लिकेशन पर एक एमडीपीआई स्क्रीन वाला एक ही एप्लीकेशन खोलूंगा, तो वे एक बड़े आकार पर कब्जा करेंगे या वे एक अच्छी जगह लेंगे क्योंकि "डीपी" गतिशील इकाई है? – Anthony
हां। एक भी क्योंकि स्क्रीन का आकार तस्वीर में आता है। आपके टैब में एक अतिरिक्त बड़ी आकार की स्क्रीन होगी। उस स्थिति में, छवि को प्रत्येक दिशा में आनुपातिक रूप से बढ़ाया जा रहा है, इसलिए यह अच्छा लग रहा है। –
तो टैबलेट और मोबाइल फोन (एक ही डीपीआई है) लेकिन अलग-अलग स्क्रीन आकार उसी 48x48px आइकन का उपयोग करेंगे? – Anthony