自定义列表适配器惯于显示图片 [英] Custom List Adapter Wont display pictures

查看:307
本文介绍了自定义列表适配器惯于显示图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我打消了我的异常信息。随着@Sam的帮助,我能够使用修复项目属性,应用程序不再强迫我关闭。虽然,从图像的TextView重新安排布局TextView的形象使其不能显示图像。没有人有任何想法,为什么?所有code可以在这里 http://www.ezzylearning.com/tutorial找到。 ASPX?TID = 1763429


  

我试图按照本教程
   http://www.ezzylearning.com/tutorial.aspx?tid=1763429 我有
  一切工作作为公布。我采用这种对于更复杂
  布局。我想改变的东西很简单。让我感动的形象
  从左侧到右侧。


 < ImageView的机器人:ID =@ + ID / imgIcon
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =FILL_PARENT
    机器人:重力=center_vertical
    机器人:layout_alignParentTop =真
    机器人:layout_alignParentBottom =真
    机器人:layout_marginRight =15dp
    机器人:layout_marginTop =5DP
    机器人:layout_marginBottom =5DP/> < TextView的机器人:ID =@ + ID / txtTitle
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:重力=center_vertical
    机器人:layout_alignParentTop =真
    机器人:layout_alignParentBottom =真
    机器人:文字样式=大胆
    机器人:TEXTSIZE =22dp
    机器人:文字颜色=#000000
    机器人:layout_marginTop =5DP
    机器人:layout_marginBottom =5DP/>

 < TextView的机器人:ID =@ + ID / txtTitle
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:重力=center_vertical
        机器人:layout_alignParentTop =真
        机器人:layout_alignParentBottom =真
        机器人:文字样式=大胆
        机器人:TEXTSIZE =22dp
        机器人:文字颜色=#000000
        机器人:layout_marginTop =5DP
        机器人:layout_marginBottom =5DP/>     < ImageView的机器人:ID =@ + ID / imgIcon
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT
        机器人:重力=center_vertical
        机器人:layout_alignParentTop =真
        机器人:layout_alignParentBottom =真
        机器人:layout_marginRight =15dp
        机器人:layout_marginTop =5DP
        机器人:layout_marginBottom =5DP/>


解决方案

这是没有意义的!


  • 尝试清洁您的项目:项目 - > 清洁...

  • 或者使用从固定属性 Android的工具

另外你的ImageView和TextView的是坐在彼此的顶部,你可能要添加的android:layout_width =WRAP_CONTENT的android: layout_weight =5来TextView的和的android:layout_weight =1到ImageView的。 ...:)

Edit: I removed my exception information. With the Help of @Sam I was able to use fix project properties and the application no longer force closes on me. Though, rearranging the layout from image textview to textview image causes it to not display images. Does anyone have any idea why? All code can be found here http://www.ezzylearning.com/tutorial.aspx?tid=1763429

I am attempting to follow this tutorial http://www.ezzylearning.com/tutorial.aspx?tid=1763429 I have everything working as posted. I am adopting this for a more complex layout. I tried to change something very simple. I moved the image from the left to the right.

BEFORE

<ImageView android:id="@+id/imgIcon"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:layout_marginRight="15dp"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp" />

 <TextView android:id="@+id/txtTitle"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:textStyle="bold"
    android:textSize="22dp"
    android:textColor="#000000"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp" />

AFTER

       <TextView android:id="@+id/txtTitle"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        android:textStyle="bold"
        android:textSize="22dp"
        android:textColor="#000000"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp" />

     <ImageView android:id="@+id/imgIcon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        android:layout_marginRight="15dp"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp" />

解决方案

This makes no sense!

  • Try cleaning your project: Project -> Clean...
  • Or use Fix Properties from Android Tools

Also your ImageView and TextView are sitting on top of each other, you might want to add android:layout_width="wrap_content" and android:layout_weight="5" to the TextView and android:layout_weight="1" to the ImageView. ... :)

这篇关于自定义列表适配器惯于显示图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆