This question is connected with my previous question. I haven't found the solution in correct way - I get screen width programmatically and add margins to ImageView in this way.
Now I have new issue.
Here is layout where weights are working correctly:
<?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:gravity="center_vertical" >
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:padding="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/txt_dir_fl_time_go"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_dir_fl_time_go_back"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_dir_fl_duration"
style="@style/WrapContent.ListItem.Isdirect"/>
<TextView
android:id="@+id/txt_dir_fl_is_direct"
style="@style/WrapContent.ListItem.Isdirect"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:padding="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/txt_ret_fl_time_go"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_ret_fl_time_go_back"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_ret_fl_duration"
style="@style/WrapContent.ListItem.Isdirect"/>
<TextView
android:id="@+id/txt_ret_fl_is_direct"
style="@style/WrapContent.ListItem.Isdirect"/>
</LinearLayout>
<TextView
android:id="@+id/txt_airline_name"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.2"
android:textSize="15sp"/>
<ImageView
android:id="@+id/img_airline"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.2"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="@drawable/ic_launcher"
android:visibility="gone"/>
<TextView
android:id="@+id/btn_buy"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.2"/>
</LinearLayout>
And almost the same layout where the weights are not working! Again! (The result is the same as in my previous question, see in the beginning of the post).
<?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:gravity="center_vertical">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.4"
android:padding="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/txt_airline_name"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_airline_plus_number"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_duration"
style="@style/WrapContent.ListItem"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:padding="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/txt_go_start_date"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_go_start_time"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_go_start_city"
style="@style/WrapContent.ListItem"
android:text="@string/txt_loading"/>
<TextView
android:id="@+id/txt_go_start_city_iata"
style="@style/WrapContent.ListItem"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:padding="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/txt_go_finish_date"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_go_finish_time"
style="@style/WrapContent.ListItem"/>
<TextView
android:id="@+id/txt_go_finish_city"
style="@style/WrapContent.ListItem"
android:text="@string/txt_loading"/>
<TextView
android:id="@+id/txt_go_finish_city_iata"
style="@style/WrapContent.ListItem"/>
</LinearLayout>
</LinearLayout>
I wonder if someone could help me..