简体   繁体   English

当我运行我的应用程序时,不会显示图像,但是会显示文本等

[英]When I run my app the images are not displayed however the text etc is

Below is the part of the code I am using to convert the imageurl into imageView using Glide. 以下是我使用Glide将imageurl转换为imageView的部分代码。

@Resolve
    private void onResolved() {
        titleTxt.setText(mInfo.getTitle());
        captionTxt.setText(mInfo.getCaption());
        timeTxt.setText(mInfo.getTime());
        Glide.with(mContext).load(mInfo.getImageUrl()).into(imageView);

Below is the json file I am using 以下是我正在使用的json文件

{
                "title": "Livery Hunting At The Festival Of Speed",
                "image_url": "http://speedhunters-wp-production.s3.amazonaws.com/wp-content/uploads/2017/07/14045435/goodwood-festivalofspeed-jordanbutters-speedhunters-1652-1200x801.jpg",
                "caption": "The Goodwood Festival of Speed boasts vehicular variety like few other annual gatherings.",
                "time": "13 hours ago"
            }

Below I've added my XML for what Im trying to achieve 在下面,我添加了我要实现的XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="10dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp"
    android:paddingBottom="20dp"
    android:gravity="left"
    android:background="@drawable/bottom_border_on_light">
    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        app:cardCornerRadius="4dp"
        app:cardElevation="1dp">
        <ImageView
            android:id="@+id/imageView"
            android:layout_width="60dp"
            android:layout_height="80dp"
            android:layout_gravity="top"
            android:scaleType="centerCrop"/>
    </android.support.v7.widget.CardView>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical">
        <TextView
            android:id="@+id/titleTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/white"
            android:textSize="16sp"
            android:typeface="sans"
            android:textStyle="normal"/>
        <TextView
            android:id="@+id/captionTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:textColor="@color/white"
            android:textSize="12sp"
            android:typeface="sans"
            android:textStyle="normal"/>
        <TextView
            android:id="@+id/timeTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_gravity="right"
            android:textColor="@color/white"
            android:textSize="12sp"
            android:typeface="sans"
            android:textStyle="normal"/>
    </LinearLayout>
</LinearLayout>

In terms of resizing do I have to resize it in my java classes or resize it by using my XML layout file. 就调整大小而言,我必须在java类中调整其大小,还是使用XML布局文件调整其大小。

Glide.with(mContext).load(mInfo.getImageUrl()).override(100,‌​100).into(imageView)‌​;

暂无
暂无

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

相关问题 我的应用程序在构建时没有任何错误,但是当我在手机上运行它时它停止工作 - my app does not have any errors when it builds, however, it stops working when I run it on my phone 我在应用程序中发送图像消息时遇到困难并遇到错误。 短信工作正常 - I have difficulty and run into errors while sending images messages in my app. Text messages work fine 当我在 localhost 上运行我的应用程序时,我能够在 html 上显示图像,但是当我部署到云平台时,图像显示为 404 - when I run my app on localhost am able to display images on html but when I deploy to a cloud platform am getting 404 for the images 启动我的应用程序时,为什么无法显示我的xmlFile? - Why is my xmlFile not getting displayed when I start my app? 它在我运行应用程序时重启我的应用程序 - it restart my app when I run the app GWT-检索时显示的图像很大; 但是现有图像显示正确 - GWT - image displaying to large when retrieved; however existing images are displayed correctly 在Android 4上运行时,我的应用程序崩溃 - My app crashes when I run it on android 4 在Google Play商店中更新我的应用程序时,如何保持我的应用程序通知显示? - How can I keep my app's notification displayed when my app is updated on Google Play store? 运行Android Studio时,没有任何图像显示。 - None of my images are displaying when I run Android Studios. 每当我在 IntelliJ 中运行我的项目时,它都可以正常工作,但是每当我尝试将其作为 jar 运行时,它都会引发异常 - Whenever I run my project in IntelliJ it works a fine, however whenever I attempt to run it as a jar it throws an exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM