2

Ich verwende CardView in Android Studio und ich möchte ImageView darin verwenden, um einige Bilder anzuzeigen, aber das Problem ist, dass es nicht das vollständige Bild zeigt. Ich möchte es skalieren, um das vollständige Bild zu zeigen.Vollbild wird nicht in CardView angezeigt

Hier ist ein Teil meines Code:

 <android.support.v7.widget.CardView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="@dimen/card_margin" 
      android:layout_marginLeft="@dimen/card_margin" 
      android:layout_marginRight="@dimen/card_margin"> 

      <LinearLayout 
       style="@style/Widget.CardContent" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="more" 
        android:textAppearance="@style/TextAppearance.AppCompat.Title" /> 

       <a.extera.CustomTxtView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/txt_more" 
        android:lineSpacingExtra="7dp" 
        android:textSize="18dp" 
        android:text="more" /> 

       <ImageView 
        android:id="@+id/backdrop1" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:scaleType="centerInside" 
        android:fitsSystemWindows="true" 
        android:orientation="vertical" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
       /> 

       <a.extera.CustomTxtView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/txt_more2" 
        android:lineSpacingExtra="7dp" 
        android:textSize="18dp" 
        android:text="more" /> 

       <ImageView 
        android:id="@+id/backdrop2" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:scaleType="centerInside" 
        android:fitsSystemWindows="true" 
        android:layout_centerVertical="true" 
        android:layout_centerHorizontal="true" 
        android:orientation="vertical" 
        app:layout_collapseMode="parallax" 
        /> 

       <a.extera.CustomTxtView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/txt_more3" 
        android:lineSpacingExtra="7dp" 
        android:textSize="18dp" 
        android:text="more" /> 

       <ImageView 
        android:id="@+id/backdrop3" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:scaleType="centerInside" 
        android:fitsSystemWindows="true" 
        android:layout_centerVertical="true" 
        android:layout_centerHorizontal="true" 
        android:adjustViewBounds="true" 
        android:orientation="horizontal" 
        app:layout_collapseMode="parallax" /> 

       <a.extera.CustomTxtView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/txt_more4" 
        android:lineSpacingExtra="7dp" 
        android:textSize="18dp" 
        android:text="more" /> 


       <ImageView 
        android:id="@+id/backdrop4" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:scaleType="centerInside" 
        android:fitsSystemWindows="true" 
        android:layout_centerVertical="true" 
        android:layout_centerHorizontal="true" 
        android:orientation="vertical" 
        app:layout_collapseMode="parallax" 
        android:adjustViewBounds="false" /> 

       <a.extera.CustomTxtView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/txt_more5" 
        android:lineSpacingExtra="7dp" 
        android:textSize="18dp" 
        android:text="more" /> 

       <ImageView 
        android:id="@+id/backdrop5" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:scaleType="centerInside" 
        android:layout_centerVertical="true" 
        android:layout_centerHorizontal="true" 
        android:orientation="vertical" 
        android:fitsSystemWindows="true" 
        app:layout_collapseMode="parallax" 
        android:adjustViewBounds="false" /> 

      </LinearLayout> 

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

zum Beispiel ist dies das volle Bild:

! https://s32.postimg.org/mntlijbn9/a_2.jpg

das ist, was es zeigt:

! https://s32.postimg.org/s6fyuyd91/image.jpg

+0

Versuchen 'fitCenter' statt' centerInside' im 'android mit: Attribut scaleType'? –

+0

ich auch fitCenter verwendet aber immer noch dosent zeigen das ganze Bild – ASHKAN

+0

können Sie einen Screenshot des aktuellen Verhaltens und das gewünschte Verhalten? –

Antwort

0

ändern android:scaleType="centerInside" in Image zu android:scaleType="fitXY"

+0

ich änderte es aber nichts passierte – ASHKAN

+0

Ändern ** Android: layout_width = "match_parent" ** in ImageView zu ** android: layout_width = "wrap_content" ** –

+0

wenn das Handy ist Landschaft Es zeigt fast das gesamte Bild, aber wenn es im Hochformat ist, zeigen Sie nur einen Teil des Bildes – ASHKAN