简体   繁体   English

初始屏幕在Nexus 4中伸展

[英]Splash screen is stretching in Nexus 4

I pasted my code below: problem is the image is stretching...... 我在下面粘贴了我的代码:问题是图像正在拉伸……

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SplashScreen"
    android:background="@color/black" >

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:src="@drawable/splashscreen"/>

</RelativeLayout>

Use wrap_content instead of match_parent: 使用wrap_content而不是match_parent:

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/splashscreen"/>

you should use 9 page image . 您应该使用9页图像。 You can generate 9-patch images from 9-path generator. 您可以从9路径生成器生成9色块图像 .

after that modify your imageView like as 之后,像这样修改您的imageView

<ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitCenter"
        android:src="@drawable/splashscreen"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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