Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 某些设备上未显示自定义视图内的ImageView墙纸_Android_Imageview_Android Custom View_Wallpaper - Fatal编程技术网

Android 某些设备上未显示自定义视图内的ImageView墙纸

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

我的自定义视图当前有以下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_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协同工作可能需要执行的步骤:

  • 确保您正在华硕上调试
  • 向项目中添加
  • 临时添加库调用以使您的应用程序可供层次结构查看器使用,可以使用示例代码
  • 打开层次结构查看器。在android studio中,即工具菜单>android子菜单>android设备监视器
  • 确保您处于层次视图透视图中
  • 选择您正在运行的应用程序(可能需要一点时间才能显示布局)
  • 使用树节点窗格查找缺少的视图
  • 通过单击视图选择该视图,使用“视图属性”选项卡验证宽度和高度的测量尺寸(位于“测量属性”部分下)是否大于0
  • 通过查看布局属性部分(mLeft、mTop、mRight、MBOTOM),验证视图是否放置在父视图边界中,以下是查看布局属性的人员的建议(尽管他正在跟踪性能问题)

  • 这款华硕平板电脑旨在惩罚人们。这不是它的第一个问题。也就是说,你能发布切换鼠标孔可见性的代码吗?鼠标孔有多大?Re:Scana实际大小是1920x1200,但我尝试将其转换为位图(以节省内存)并将其缩放到1280x800,但它仍然无法显示。你可以发布一些代码来了解更多信息吗?你是否尝试过使用相对布局,它是否可以使用?那么错误就在你的布局中。您应该提供自定义布局和更改可见性的代码。