【问题标题】:Remove the white space frame from the splash image从启动图像中删除空白框
【发布时间】:2015-11-09 04:37:01
【问题描述】:

我正在使用我的 s4 Samsung 设备制作图像,我试图将其作为我的应用程序的初始图像,但我面临的问题是图像显示为宽空白框架。如何删除它?

XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout       
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
    android:id="@+id/fl_draw"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/splash_background"
        android:rotation="90"
        android:adjustViewBounds="true" />

</FrameLayout>

</RelativeLayout>

我之前在 LinearLayout 中将图像显示为下面的代码,但它显示为 horozintal:

之前的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
     android:background= "@drawable/splash_background"
    >

</LinearLayout> 

尝试哈桑解决方案前的截图:

在尝试了哈桑解决方案 android:scaleType="centerCrop"

【问题讨论】:

  • 可以添加截图吗?

标签: android


【解决方案1】:
<ImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/splash_background"
    android:scaleType="centerCrop" />

在开发移动应用程序时的任何图形设计师。应该采纳 考虑移动开发指南。

在设计初始屏幕图像时,设计师有两种解决方案:

  1. 生成具有纯色背景或无渐变透明的图像。在这种情况下,图像可以以背景颜色显示在中心。

  2. 生成的图像在从顶部/底部或左侧/右侧裁剪时看起来并不难看(取决于屏幕比例)。在这种情况下,您使用centerCrop 作为scaleType

【讨论】:

  • 我已经用 android:scaleType="centerCrop" 试过了,但没有 seccuss。
  • 你有什么?可能你的图片分辨率太低了。
  • 检查以下问题。 stackoverflow.com/questions/17747879/… 它有一些图片可以证明这一点。
  • 我添加了图片来说明它。
  • 是的,现在看起来好多了,谢谢:)。请从您的答案中删除这些属性。我已经将其标记为已回答。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-08-14
  • 1970-01-01
  • 2022-07-04
  • 1970-01-01
  • 2018-04-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多