我有一个1080x1920px
图像,我想在我的应用程序中用作背景图像。位图太大
在我Galaxy S6 i
牛逼工作正常,但是当我去到一个较小的屏幕尺寸(S4即)我收到这样的:
W/OpenGLRenderer﹕ Bitmap too large to be uploaded into a texture (3240x5760, max=4096x4096)
除了不显示在所有的形象。
这是我的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}"
android:background="@drawable/bg">
<EditText android:id="@+id/username_textfield"
android:layout_width="270dp"
android:layout_height="40dp"
android:hint="Username"
android:textColorHint="#ffffff"
android:textColor="#ffffff"
android:ellipsize="start"
android:gravity="center_horizontal"
android:singleLine="true"
android:layout_marginTop="50dp"
android:layout_marginLeft="60dp"
android:background="@drawable/textfield_bg"/>
<EditText android:id="@+id/password_textfield"
android:layout_width="270dp"
android:layout_height="40dp"
android:hint="Password"
android:textColorHint="#ffffff"
android:textColor="#ffffff"
android:ellipsize="start"
android:gravity="center_horizontal"
android:singleLine="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="60dp"
android:background="@drawable/textfield_bg"/>
我的MainActivity是除外的onCreate空。 我已阅读关于此问题的其他帖子,但没有人为我提供任何真正的解决方案。
的[ “位图太大,无法上传到纹理”]可能的复制(http://stackoverflow.com/questions/10271020/bitmap-too-large-to-被上传到纹理中) – Shark
参见RomainGuy的[在这里回答](http://stackoverflow.com/questions/7428996/hw-accelerated-activity-how-to-get-opengl-texture-size-limit) – Shark
图像根据设备的像素密度进行缩放。图像实际上太大了。你可以确定OpenGL将允许的最大尺寸,并调整你的位图的大小,以适应如果你希望它适用于所有位图,包括那些动态添加的位图。关于链接@Shark对罗曼的答案,你可能会想看看这个以及:http://stackoverflow.com/questions/26985858/gles10-glgetintegerv-returns-0-in-lollipop-only/27092070#comment59878380_27092070 – zgc7009