简体   繁体   中英

Background image not filling layout and taking extra space above and below

以白卡为背景的线性布局

The blue bordered part is a LinearLayout and the white card part is the background image I have used. The background image is not filling the layout.

I have tried keeping an ImageView in a FrameLayout and making scale type as centerCrop but even that didn't work. I can use a CardView instead but I want this type of shadow as shown in the picture which I couldn't achieve with attributes of CardView .

Here is my code:

<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="@drawable/squared_background_shadow">
</LinearLayout>
  1. Maybe the issue is in the picture you use, it could be png with transparent background?
  2. Which special attributes are you using in LinearLayout , which don't support by CardView ?
  3. You can try android:scaleType="fitXY"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM