Unwanted padding around an ImageView

前端 未结 8 767
闹比i
闹比i 2020-12-02 05:20

I need to include a header graphic in all of my activities/views. The file with the header is called header.xml:



        
相关标签:
8条回答
  • 2020-12-02 05:47

    May be you can give specific height to imageView say 50dp or 40dp and adjust image to make green border dissappear.

    Eg: android:layout_height="40dp"

    0 讨论(0)
  • 2020-12-02 05:48

    It has to do with the image aspect ratio. By default, the system keeps the original aspect ratio of the image source. Which in most cases does not exactly match the layout or dimensions specified in the layout. Therefore,

    1. Either change the size of the image to fit the specified layout, or
    2. Use android:scaleType to fit the image. For example, you can specify android:scaleType="fitXY"
    0 讨论(0)
提交回复
热议问题