2015-09-29 9 views
27

का संकेत आकार बदलने के लिए कैसे यह मेरी एक्सएमएलTextInputLayout

<android.support.design.widget.TextInputLayout 
       style="@style/main_input_text" 
       android:layout_marginTop="@dimen/activity_medium_margin" 
       app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"> 

       <android.support.v7.widget.AppCompatEditText 
        style="@style/main_edit_text" 
        android:inputType="text" /> 

</android.support.design.widget.TextInputLayout> 

है और इस शैली

<style name="main_input_text"> 
     <item name="android:layout_width">match_parent</item> 
     <item name="android:layout_height">@dimen/activity_edittext_height</item> 
     <item name="android:background">@drawable/mc_shape_border_button_transparent</item> 
     <item name="android:gravity">center_vertical</item> 
     <item name="android:paddingTop">@dimen/activity_extra_small_margin</item> 
     <item name="android:paddingBottom">@dimen/activity_extra_small_margin</item> 
     <item name="android:keyTextSize">8sp</item> 
     <item name="android:textSize">8sp</item> 
</style> 

मैं मदद नहीं कर hintSize, textSize और keyTextSize की तरह कुछ भी नहीं मिलता है है

उत्तर

73

रूप styles.xml में परिभाषित किया गया है अपने styles.xml में:

<android.support.design.widget.TextInputLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="@dimen/activity_horizontal_margin" 
     android:layout_marginRight="@dimen/activity_horizontal_margin" 
     android:layout_marginTop="12dp" 
     app:hintTextAppearance="@style/TextLabel" 
     android:minHeight="30dp"> 
+0

यह मेरे लिए काम करता है! धन्यवाद! – TiPo

-8

आप ऐसा करने के लिए HTML विशेषताओं का उपयोग कर सकते हैं:

myView.setHint(Html.fromHtml("<small><small><small>" + 
     getString(R.string.hint) + "</small></small></small>")); 

आप यहां से एचटीएमएल टैग का विवरण प्राप्त कर सकते हैं: http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html

+0

नहीं के बारे में उस प्रश्न का शैली को जोड़ने। – eugeneek

-2

आप एडिटटेक्स्ट पर फ़ॉन्ट आकार को कम कर सकते हैं - इससे संकेत के आकार को भी कम कर दिया जाएगा। i.e. android: textSize = "16sp"

+0

समस्या यह है कि मैं टेक्स्ट आकार को बड़ा और छोटा संकेत देना चाहता हूं। –

+0

वैसे भी यह काम नहीं किया गया है। संकेत आकार केवल 'EditText' में वृद्धि हुई है, न कि' TextInputLayout' में। – eugeneek

4

XML में TextInputLayout के app:errorTextAppearance को बदलें।

<android.support.design.widget.TextInputLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      app:errorTextAppearance="@style/CustomTextInputLayoutStyle.ErrorTextStyle"> 

कहाँ CustomTextInputLayoutStyle.ErrorTextStyle अपने लेआउट फ़ाइल में

<style name="TextLabel" parent="TextAppearance.Design.Hint"> 
    <item name="android:textSize">16sp</item> 
</style> 

और फिर

<style name="CustomTextInputLayoutStyle.ErrorTextStyle" parent="TextAppearance.Design.Error"> 
     <item name="android:textSize">10sp</item> 
</style> 
0

1) जोड़ेएक शैली

<android.support.design.widget.TextInputLayout xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent"  
    android:layout_height="wrap_content" 
    app:hintTextAppearance="@style/TextInputLayoutHintText" > 
    <android.support.design.widget.TextInputEditText    
     android:layout_width="match_parent"    
     android:layout_height="wrap_content" 
     android:textSize="16sp" /> 
</android.support.design.widget.TextInputLayout> 

2) के साथ ४७५४३५३२१० अपने InputLayout को तो बस अपनी styles.xml

<style name="TextInputLayoutHintText"> 
    <item name="android:textColor">@color/gray</item> 
    <item name="android:textSize">12sp</item></style> 
संबंधित मुद्दे