简体   繁体   English

图片显示在预览中,但不在Android平板电脑上显示。 XML问题?

[英]Image showing in preview but not on Android tablet. XML issue?

So I have been working on an Android application to make an application for use with DJI's consumer level drones. 因此,我一直在开发一个Android应用程序,以使该应用程序可与DJI的消费者级无人机一起使用。 I have been making the user interface and using XML throughout the project with no issues. 我一直在制作用户界面,并在整个项目中使用XML都没有问题。 I want to add a .png to the UI just so that my logo is showing. 我只想向用户界面添加.png以便显示徽标。 When I preview it in Android Studio, I can see the logo being shown but when it is run on the tablet, it is not there. 在Android Studio中预览时,可以看到显示的徽标,但是在平板电脑上运行时,该徽标不存在。 Everything else using XML is fine though. 不过,使用XML的其他一切都很好。 I even preview using the same resolution/ screen size as my tablet I am using (cheap Hudl 2 tablet). 我什至使用与我使用的平板电脑相同的分辨率/屏幕尺寸进行预览(便宜的Hudl 2平板电脑)。

If anybody has any ideas about how I can get this to work, I would appreciate it. 如果有人对我如何使其工作有任何想法,我将不胜感激。 I have shown my university lecturer it and he couldn't give me an answer too as nothing seems to be out of the ordinary. 我已经向我的大学讲师展示了它,他也无法给我答案,因为似乎没有什么不寻常的。

Android studio preview Android Studio预览

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/macrosfordji"
    android:layout_alignParentTop="true"
    android:layout_alignParentEnd="true" />

Try this (android:src="..." instead app:srcCompat="..."): 试试这个(android:src =“ ...”代替app:srcCompat =“ ...”):

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/macrosfordji"
    android:layout_alignParentTop="true"
    android:layout_alignParentEnd="true" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 图片显示在模拟器上,但未显示在Android平板电脑上 - Image showing on emulator but not on Android tablet 我的Android 6平板电脑上不提供受限的用户个人资料。 怎么会? - Restricted user profile not available on my Android 6 tablet. How come? 在Android中显示图像预览 - Showing an image preview in Android Android Studio XML 预览未显示 - Android Studio XML preview not showing 平板电脑中的屏幕布局受到干扰。 在Tablet Emulator和5英寸android手机上正常工作 - Screen layout disturbed in Tablet. Works fine on Tablet Emulator and on 5" android phone Android onpreviewframe:图像视图上的预览在平板电脑上显示绿色/粉红色图像 - Android onpreviewframe:Preview on image views shows green/pink image on tablet 选择文本功能。 使用android3.1平板电脑无法在webview中工作。 - Select text functionality. Not working in webview using android3.1 tablet. Android Studio 未显示 XML 布局的预览 - Android Studio not showing preview for XML layouts 无法从 Android 平板电脑声明 WebUSB 接口(设备或资源繁忙 16)。 Windows 工作正常 - Unable to Claim WebUSB Interface(device or resource busy 16) from Android Tablet. Windows works fine Android 工作室 xml 预览不显示且没有消息 - Android studio xml preview not showing and has no message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM