ImageView wallpapers inside custom view are not displayed on some devices

I currently have the following XML code for my custom view:

<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> 

On some devices (for example, Samsung Galaxy Tab 4), the mouse_hole wallpaper image is displayed in order, while it does not appear at all on other devices, such as Asus Transformer Infinity TF700T. The visibility of mouse_hole changes its appearance to the software side when I start my game. My custom view extends RelativeLayout .

Can anyone find out what's wrong here?

+6
source share
2 answers

I had a similar problem. Try to put your mouse_hole image in each trader for different screen sizes:

cooker hood

hood-ldpi

range hood-mdpi

range hood-xhdpi

range hood-xxhdpi

range hood-xxxhdpi

0
source

Maybe the layout is not updating properly. I would suggest using the HierarchyViewer to check the size and location of the missing view on Asus Transformer Infinity. Here are the steps you should probably take to get Hierarchy Viewer to work with Asus:

  • Make sure you debug Asus
  • Add a ViewServer Jar to your project.
  • Temporarily add library calls to make your application available for viewing the hierarchy, a code example can be here
  • Open the hierarchy viewer. In the android studio, which is the menu "Tools"> "Submenu Android"> "Monitor Android devices"
  • Make sure you are in the Hierarchy View Perspective
  • Select the application you are using (it may take a little to display the layout)
  • Use the node tree panel to find the missing view
  • Select a view by clicking on it, use the "View Properties" tab to make sure that the measured size (found in the measure properties section) for width and height is greater than 0
  • Make sure the view is placed within the boundaries of the parent view by looking at the layout properties section (mLeft, mTop, mRight, mBottom), here is a link for someone to look at the layout properties (although it is tracking a performance issue).
0
source

All Articles