Dynamic change in textView in xml-resource



  • There's a problem with the print. Is there any way, depending on the number of words, to change the size of the print, not programmatic, but straight into xml ?

       <RelativeLayout
            android:id="@+id/titleDescription"
            android:layout_width="196dp"
            android:layout_height="match_parent"
            android:layout_below="@+id/linearLayoutTop"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/progressbar"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="16dp"
            android:paddingTop="20.5dp"
            android:paddingBottom="20.5dp"
            >
    
        &lt;TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:text="Rihanna Love the way"
            android:textColor="@color/colorFontBlue"
            android:textSize="20sp"
            android:typeface="sans"
            android:singleLine="false"
            /&gt;
    
        &lt;TextView
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/title"
            android:singleLine="false"
            android:text="Just gona stand there and ..."
            android:textColor="#535353"
            android:textSize="15dip"
            /&gt;
    
    &lt;/RelativeLayout&gt;
    



  • No, the Native SDK cannot.

    Although there's a new library from Google-- http://developer.android.com/intl/ru/tools/data-binding/guide.html There is some logic in xml-resource, for example, a thermal operator is present in the xml-language of the library, logical operators, and there is an opportunity to challenge methods directly from the xml-resource, so it is possible.

    But it's easier and faster to do all this dynamically through Orthodox java code.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2