2012-07-10 14 views
6

यह TextView जैसे कुछ विचारों लगता है अपनी ही गद्दी या मार्जिन है ... मेरा मतलब है मैं जब textSize 16dp TextView के लिए सेट कर रहा हूं, इसे और अधिक तो 24 पिक्सेल hdpi डिवाइस स्क्रीन पर इस पर नियंत्रण प्रदर्शित करने के लिए ले जाता है । @ Dimen/activity_vertical_margin या @ Dimen/activity_horizontal_margin: शायद मैं कुछ याद कर रहा हूँ, मददएंड्रॉयड दृश्य डिफ़ॉल्ट गद्दी या मार्जिन

<LinearLayout 
     android:id="@+id/uc_button_title_panel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1px" 
      android:background="@color/closed_red" /> 

     <TextView 
      android:id="@+id/uc_button_title_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_margin="0dp" 
      android:includeFontPadding="false" 
      android:background="@null" 
      android:padding="0dp" 
      android:text="@string/demo_text" 
      android:textColor="#325083" 
      android:textSize="16dp" 
      android:textStyle="bold" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1px" 
      android:background="@color/closed_red" /> 
    </LinearLayout> 
+0

तुम यहाँ से 1.5x गुणक के आधार पर वास्तव में 24 होने के लिए यह उम्मीद कर रहे हैं? –

+0

अच्छा हाँ .. मुझे लगता है कि अगर मैं hdpi डिवाइस पर 24px टेक्स्ट आकार प्राप्त करना चाहता हूं, तो मुझे टेक्स्ट आकार को 16 डीपी पर सेट करना होगा या नहीं? – Orest

+0

हाँ आप सही हैं, सिर्फ रिश्ते को समझने की कोशिश कर रहे थे। तो क्या आप कह रहे हैं कि वास्तविक पाठ 24px से बड़ा है या पाठ + इसके आस-पास की जगह है? –

उत्तर

4
<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="@dimen/activity_vertical_margin" 
     android:layout_marginBottom="@dimen/activity_vertical_margin" 
     android:layout_marginLeft="@dimen/activity_horizontal_margin" 
     android:layout_marginRight="@dimen/activity_horizontal_margin" 
     android:orientation="vertical"> 
    </LinearLayout> 

एंड्रॉयड में लेआउट का उपयोग करते समय कृपया, डिफ़ॉल्ट मार्जिन और उपलब्ध गद्दी यह है। मैंने ऊपर एक उदाहरण कोड रखा है। http://developer.android.com/guide/practices/screens_support.html:

संबंधित मुद्दे