【问题标题】:Android background looks stretchedAndroid 背景看起来很拉伸
【发布时间】:2011-03-25 06:17:32
【问题描述】:

我尝试使用 HVGA 分辨率(320x480 - 纵向)在 Android 上制作启动画面。我用 HVA 分辨率用 PNG 制作了一个启动画面,但背景是水平拉伸的。

我的splash.xml代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/background_320x480">
</LinearLayout>

我在 java 文件中没有代码。

有什么想法吗?提前致谢!

【问题讨论】:

  • 是全屏模式,还是有标题栏和/或状态栏?
  • 嗨 Rajath,不,没有标题栏和状态栏。是的,它处于全屏模式,因为它只是一个仅停留 3 秒的初始屏幕。
  • 尝试设置背景[这里][1] [1]:stackoverflow.com/questions/5889507/…

标签: android layout splash-screen


【解决方案1】:

试试这个代码,更好地将图像显示到 imageview 控件中..

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    android:src="@drawable/splash"
    android:scaleType="centerCrop"
    />

</RelativeLayout>

【讨论】:

    猜你喜欢
    • 2013-10-03
    • 1970-01-01
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    • 2011-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多