1

Я использую горизонтальную RecyclerView:9-патч фон в горизонтальном recyclerview

<android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:id="@+id/chronology_rv_players"/> 

, который содержит несколько из следующих CardViews:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.CardView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="45dp" 
    android:layout_margin="3dp" 
    app:cardCornerRadius="10dp" 
    app:cardBackgroundColor="@android:color/transparent" 
    app:cardElevation="0dp" 
    app:cardMaxElevation="0dp" 
    android:padding="0dp"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:orientation="horizontal" 
     android:padding="0dp"> 

     ... 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:padding="0dp"> 

      <ImageView 
       android:id="@+id/iv_player_list_right" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:src="@drawable/background_player_right" 
       android:scaleType="fitXY" 
       android:padding="0dp"/> 

       ... 

     </RelativeLayout> 

    </LinearLayout> 

</android.support.v7.widget.CardView> 

вытяжки "background_player_right" является следующим 9-патч изображение:

enter image description here

Тем не менее, 9-патч изображение не не растягивается до правого конца CardView изображения:

enter image description here

Я думаю, что это связано с тем, что я использую горизонтальную RecyclerView (аналогично, я не был в состоянии выровнять текст справа от CardView), но я не знаю, как получить ожидаемые результаты.

У вас есть идея?

ответ

1

Пропустите ImageView и установите патч 9 прямо на задний план RelativeLayout.

Смежные вопросы