Android 某些设备上未显示自定义视图内的ImageView墙纸
我的自定义视图当前有以下XML代码:Android 某些设备上未显示自定义视图内的ImageView墙纸,android,imageview,android-custom-view,wallpaper,Android,Imageview,Android Custom View,Wallpaper,我的自定义视图当前有以下XML代码: <com.pink.jazz.RootView android:id="@+id/rootView" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout
<com.pink.jazz.RootView
android:id="@+id/rootView"
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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MouseActivity" >
<ImageView
android:id="@+id/mouse_hole"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/mouse_hole"
android:visibility="gone"
/>
</com.pink.jazz.RootView>
在某些设备(如三星Galaxy Tab 4)上,壁纸图像显示良好,而在其他设备(如华硕Transformer Infinity TF700T)上则完全不显示。当我开始游戏时,鼠标洞
的可见性将以编程方式更改为可见。我的自定义视图扩展了RelativeLayout
有人知道这里出了什么问题吗?我也有类似的问题。尝试将图像
鼠标孔
放入每一个forder中,以适应不同的屏幕尺寸:
可拉伸hdpi
可拉伸低密度聚乙烯
可拉伸mdpi
可拉伸xhdpi
可拉伸xxhdpi
可绘制的xxxhdpi可能是布局未正确更新。我建议使用HierarchyViewer检查华硕Transformer Infinity上缺失视图的大小和位置。以下是让Hierarchy Viewer与ASU协同工作可能需要执行的步骤:
这款华硕平板电脑旨在惩罚人们。这不是它的第一个问题。也就是说,你能发布切换鼠标孔可见性的代码吗?鼠标孔有多大?Re:Scana实际大小是1920x1200,但我尝试将其转换为位图(以节省内存)并将其缩放到1280x800,但它仍然无法显示。你可以发布一些代码来了解更多信息吗?你是否尝试过使用相对布局,它是否可以使用?那么错误就在你的布局中。您应该提供自定义布局和更改可见性的代码。