Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to let a textview take 75 percent of its parent width android xml

// Use android:layout_weight to set percentage for components
<LinearLayout
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <Button
        android:text="left" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight=".70" /> 

    <Button
        android:text="right" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight=".30" />

</LinearLayout>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #textview #percent #parent #width #android #xml
ADD COMMENT
Topic
Name
4+6 =