java - How can I fix the column width? -
now width of each row changing depending on size of text. fixed size each column excel. should changed? shouldn't match_parent since parent has large width..
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <textview android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/text_margin" android:textappearance="?attr/textappearancelistitem" /> <textview android:id="@+id/email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/text_margin" android:textappearance="?attr/textappearancelistitem" /> <textview android:id="@+id/short_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/text_margin" android:textappearance="?attr/textappearancelistitem" /> </linearlayout>
edit
current edition shows like
chris chris@gmail.com r apostole apostole@gmail.com -
but want is
chris chris@gmail.com r apostole apostole@gmail.com -
i tried @priyank prajapati 's version still gives former layout
change parent android:layout_width="wrap_content"
android:layout_width="match_parent"
note: using android:layout_weight="1"
with android:layout_width="0dp"
each unifrom rows
full code:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightsum="10"> <textview android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_horizontal_margin" android:layout_weight="2" android:text="chris" android:textappearance="?attr/textappearancelistitem" /> <textview android:id="@+id/email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_horizontal_margin" android:layout_weight="8" android:text="chris@gmail.com" android:textappearance="?attr/textappearancelistitem" /> <textview android:id="@+id/short_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_horizontal_margin" android:layout_weight="1" android:text="r" android:textappearance="?attr/textappearancelistitem" /> </linearlayout>
Comments
Post a Comment