我想爲列表的所有列實現相同的佈局高度。我使用GridLayoutManagerGridLayoutManager列高度問題
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(mCon,2);
recyclerView.setLayoutManager(layoutManager);
,這是列中的XML文件
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_8dp"
android:layout_marginLeft="@dimen/padding_4dp"
android:layout_marginRight="@dimen/padding_4dp"
android:clickable="true"
android:padding="1dp"
card_view:cardCornerRadius="@dimen/padding_2dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp">
<RelativeLayout
android:id="@+id/rel_first"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/padding_8dp">
<ImageView
android:id="@+id/userimg"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="@dimen/padding_16dp"
android:layout_marginTop="@dimen/padding_8dp"
android:background="@drawable/user_profile_default" />
<RelativeLayout
android:id="@+id/nameRL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_4dp"
android:layout_toRightOf="@+id/userimg"
android:orientation="vertical">
<com.skcsllp.mutterfly.widgets.MfTextView
android:id="@+id/u_name"
style="@style/textview.bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_16dp"
android:layout_marginStart="@dimen/padding_16dp"
android:layout_marginTop="@dimen/padding_8dp"
android:text="Akshay"
android:textColor="@color/new_text_grey"
android:textSize="@dimen/text_size_big_16"
/>
<ImageView
android:id="@+id/location1"
android:layout_width="7dp"
android:layout_height="10dp"
android:layout_below="@+id/u_name"
android:layout_marginBottom="@dimen/padding_4dp"
android:layout_marginLeft="@dimen/padding_16dp"
android:layout_marginStart="@dimen/padding_16dp"
android:layout_marginTop="@dimen/padding_8dp"
android:background="@drawable/location_pin"
/>
<com.skcsllp.mutterfly.widgets.MfTextView
android:id="@+id/location"
style="@style/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/u_name"
android:layout_marginLeft="@dimen/padding_4dp"
android:layout_marginTop="@dimen/padding_8dp"
android:layout_toEndOf="@+id/location1"
android:layout_toRightOf="@+id/location1"
android:text="2.5km"
android:textSize="@dimen/text_size_extra_extra_small_10"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/nameRL"
android:layout_gravity="center"
android:layout_marginTop="@dimen/padding_8dp"
android:background="@color/grey_bottmon_tab"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/main_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rel_first"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/padding_16dp"
android:layout_marginTop="@dimen/padding_4dp"
android:gravity="center"
android:minHeight="80dp">
<LinearLayout
android:id="@+id/ln_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/padding_16dp"
android:layout_marginRight="@dimen/padding_16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/padding_24dp"
android:layout_height="@dimen/padding_24dp"
android:layout_marginTop="@dimen/padding_16dp"
android:background="@drawable/cart_icon"
android:padding="@dimen/padding_2dp"
/>
<com.skcsllp.mutterfly.widgets.MfTextView
android:id="@+id/item_name"
style="@style/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_8dp"
android:layout_marginLeft="@dimen/padding_8dp"
android:layout_marginTop="@dimen/padding_16dp"
android:text="Laptop "
android:textColor="@color/primary"
android:textSize="@dimen/text_size_big_16"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/ln_cal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ln_cart"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/padding_16dp"
android:layout_marginRight="@dimen/padding_16dp"
android:layout_marginTop="@dimen/padding_4dp"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/padding_24dp"
android:layout_height="@dimen/padding_24dp"
android:background="@drawable/ic_cal"
/>
<com.skcsllp.mutterfly.widgets.MfTextView
android:id="@+id/date"
style="@style/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_16dp"
android:layout_marginLeft="@dimen/padding_8dp"
android:layout_marginTop="@dimen/padding_4dp"
android:text=" 7 july - 8 july"
android:textColor="@color/new_text_grey"
android:textSize="@dimen/text_size_small_14"
/>
</LinearLayout>
</RelativeLayout>
<View
android:id="@+id/view_second"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/main_rl"
android:layout_marginTop="@dimen/padding_8dp"
android:background="@color/grey_bottmon_tab"
/>
<RelativeLayout
android:id="@+id/main_ln_sec"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view_second"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/number_of_provider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="3"
android:visibility="gone"
/>
<TextView
android:id="@+id/offer_sent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="offersent"
android:visibility="gone"
/>
<ImageView
android:id="@+id/accept_image"
android:layout_width="@dimen/padding_32dp"
android:layout_height="@dimen/padding_32dp"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/padding_16dp"
android:background="@drawable/check_mark"
android:gravity="center"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
這兩列具有相同的高度,但底部蜱是越來越置於不同,當項目名稱爲大。任何人都可以建議我如何解決這個問題。謝謝
哪一個是底部滴答?和一些截圖。 – sumandas
秒列綠色的勾被向上提升相比,第一個 –