ImageView displaying in layout but not on actual device

前端 未结 9 1794
悲&欢浪女
悲&欢浪女 2020-12-13 12:50

I have an ImageView that I want to display matching the full width of the device, I realized that like this:



        
相关标签:
9条回答
  • 2020-12-13 13:30

    Use drawable-nodpi folder in res if image is too big.

    0 讨论(0)
  • 2020-12-13 13:32

    you can use:

    android:background="@drawable/home_bar"
    

    instead of:

    android:src="@drawable/home_bar"
    
    0 讨论(0)
  • 2020-12-13 13:37

    I had the same issue, it is only showing in Design tab for Android Studio 2.2.

    What I did to make it work is to change the automatic key assigned (populated via Drag/Drop ImageView) from app:srcCompat="@drawable/logo" to android:src="@drawable/logo" in Text tab to make it appear on both the emulator and the device e.g

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/logo"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="75dp"
        android:id="@+id/logoImageView"
        android:scaleType="fitXY"
        android:scaleX="1.5"
        android:scaleY="1.5" />
    
    0 讨论(0)
提交回复
热议问题