считывает данные с сервера и показывает это в виде карты. я делаю так много способов, чтобы придать весу карте, но не работает!layout_weight не работает для CardView
это мой код:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
card_view:cardCornerRadius="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<ImageView
android:layout_gravity="center"
android:id="@+id/img"
android:scaleType="fitXY"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_name"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_api_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
и выглядеть следующим образом:
, но хочу, чтобы мой вид карты выглядеть следующим образом:
как можно я делаю это ? Важным является: не хочу указывать высоту номер как 50dp хочу дать вес причина во всех устройствах выглядят как pic2. пожалуйста, помогите Тпх
веса работать с LinearLayout, не cardview – piotrek1543
знаю, что! но я всегда помещаю свои элементы в макет лайнера, а затем придаю ему вес. если у вас есть какое-то решение, дайте мне не научить меня – erfan