我有一个闪屏,ImageView播放背景的一部分.无论我是否允许我的位图缩放(我这样做),图像质量都很糟糕.我认为这会减少颜色深度.我已经环顾四周了,一个建议就是把我的形象放进去,raw而不是drawable那个也没用.这是一个截图:

到底发生了什么,我该如何解决?
编辑:我没有以编程方式应用此位图,因此没有相关的Java代码.以下是此活动的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayoutSplash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawingCacheQuality="high"
android:orientation="vertical"
android:padding="@dimen/splash_padding"
android:scrollbarAlwaysDrawVerticalTrack="true"
tools:context=".SplashActivity" >
<ImageView
android:id="@+id/ImageViewBg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/logo_description"
android:scaleType="centerCrop"
android:src="@drawable/splash_bg_register" />
<ImageView
android:id="@+id/ImageViewLogo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/logo_description"
android:maxHeight="@dimen/logo_maxheight"
android:maxWidth="@dimen/logo_maxwidth"
android:layout_centerVertical="true"
android:src="@drawable/logo" />
<TextView
android:id="@+id/TextViewCopyright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="@string/copyright"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/white_50"
android:textSize="@dimen/copyright_size" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
编辑:我getWindow().setFormat(PixelFormat.RGBA_8888);按照建议尝试了一个明显的区别,但条带仍然存在.这是我用作背景的图像.
这些主要是编译器设计问题.当您的编译器编译它时,例如:
int * pData = new int[256];
如何即时分配内存?编译器是否调用为您分配内存的OS例程,还是编译为您分配内存的函数?
此外,当你写这样的东西:
if (x == 5)
int y;
Run Code Online (Sandbox Code Playgroud)
由于内存不是在运行时分配的,我假设数据占用了程序数据段的一些空间.由于编译器无法确定int y;分支是否将在运行时执行,因此是否为变量保留的内存是否int y;被执行?如果它是保留的,那么mem分配块中可能执行也可能不执行的任何变量的内存效率是否更高?
谢谢
c++ memory-management compiler-theory conditional-compilation new-operator
我知道当一个对象在堆上实例化时,至少分配足够的内存来保存对象的ivars.我的问题是编译器如何存储方法.内存中只有一个方法代码实例吗?或者代码是在内存中生成对象的固有部分,与ivars连续存储并执行?
似乎后者就是这种情况,即使像NSStrings这样的小事也需要(相对)大量的内存(也NSString从中继承方法NSObject).
或者该方法是在内存中存储一次并将指针传递给拥有它的对象?
我在Swift中有一个枚举:
enum Orientation: Int
{
case Rot_0 = 0, Rot_90, Rot_180, Rot_270
Run Code Online (Sandbox Code Playgroud)
我的枚举中的非静态方法旨在顺时针或逆时针移动方向:
func rotate(clockwise: Bool)
{
var nextRawValue = self.rawValue + (clockwise ? 1 : -1)
if nextRawValue < Orientation.Rot_0.rawValue
{
nextRawValue = Orientation.Rot_270.rawValue
}
else if nextRawValue > Orientation.Rot_270.rawValue
{
nextRawValue = Orientation.Rot_0.rawValue
}
self = Orientation(rawValue: nextRawValue)
}
Run Code Online (Sandbox Code Playgroud)
编译器告诉我你不能self在方法中分配.我无法理解为什么这是不可能的.
我唯一能想到的是使用静态方法rotate(orientation: Orientation, clockwise: Bool),但在这种情况下,必须将返回值显式地分配回枚举变量,这对我来说就像编码错误一样.似乎更有用的是说myOrientation.rotate()并且隐含地改变了价值.
这个问题有优雅的解决方案吗?
多谢你们!
快问.枚举类型有多宽?它们是表示枚举所需的最小宽度还是所有enum int?如果它们是整数,你可以改变枚举的宽度,还是你必须为每次出现输入强制转换?
c++ ×2
android ×1
c ×1
c# ×1
enumeration ×1
enums ×1
methods ×1
new-operator ×1
objective-c ×1
size ×1
swift ×1