Reputation: 25
How to make this aligned to left? I want the second column is aligned to left. I using layout_weight but when the content length is diferent it will change the width of the parent view
layout.xml
<LinearLayout
...
android:weightSum="1.1">
<FrameLayout
...
android:layout_weight="0.5">
<TextView/>
</FrameLayout>
<FrameLayout
...
android:layout_weight="0.3">
<TextView/>
</FrameLayout>
<FrameLayout
...
android:layout_weight="0.3">
<TextView/>
</FrameLayout>
</LinearLayout>
Upvotes: 0
Views: 57
Reputation: 284
this is an example of mine:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Music"
android:textSize="20dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="fewwe"
android:textSize="20dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="wfeewf"
android:textSize="20dp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="DasDAS"
android:textSize="20dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="dASfafFADS"
android:textSize="20dp"/>
</LinearLayout>
</LinearLayout>
and this is the result:
You have to put always the layout_weight=1
and remember the layout_width="match_parent"
I hope this example can help you to solve your problem, cya :)
Upvotes: 1