解决RecyclerView中使用权重后图片不显示问题

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lixiang_Y/article/details/67656183
在RecyclerView的使用中,如果我们的最外层布局用到了权重适配,那么需要格外小心,我们的最外层布局框架不能用LinearLayout布局,切记!必须要把最外层布局换为其他的布局,推荐RelativeLayout,将我们的权重适配放到第二层布局中包裹。至于具体个中原因我也不是非常清楚,可能是RecyclerView还没完善好。
展开阅读全文

那个高人解决图片显示,而显示红叉问题

03-24

请帮忙看一下用servlet下载数据库里图片的错误,急!rn那个高人解决了图片不显示,而显示红叉问题?请帮忙。给你作揖了。rnrn数据库不同,程序也不同吧?我用的是sql server, 存的格式image和binary我都试了,结果下载的图片rn不显示,而在图片的地方只显示一个带有叉型(X)的方框,我估计图片还是下载下来了,就是没显示出来,rn对不对?我该如何改?rn程序如下:rnrnimport java.sql.*;rnimport java.io.*;rnimport java.util.*;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnrnrnpublic class DownLoad2 extends HttpServletrnrn public DownLoad2() rn rnrn public void doGet(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn doPost(request,response);rn rnrn public void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn System.out.println("======DownLoad begin=====");rn tryrn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn Connection conn = DriverManager.getConnection("jdbc:odbc:ds1","u3","p3");rn Statement stmt=conn.createStatement();rn String sql="select * from t1";rn ResultSet rs=stmt.executeQuery(sql);rnrn if(rs.next())rn InputStream in = rs.getBinaryStream(2);rn response.setContentType("image/jpeg");rn ServletOutputStream sout = response.getOutputStream();rn byte[] b = new byte[1024*1024];rn int len;rn while((len=in.read(b)) >0)rn sout.write(b,0,len);rn rnrn sout.flush();rn sout.close();rn in.close();rn rs.close();rn stmt.close();rn conn.close();rn rn catch(Exception ex)rn ex.printStackTrace();rn rn System.out.println("======DownLoad end=====");rn rnrnrn 论坛

RecyclerView图片加载顺序问题

03-21

我能实现图片加载了,但是只会从上向下加载,不会先加载当前页面。rn代码贴上:rn[code=java]public class GalleryAdapter extends RecyclerView.Adapter rnrn private Context mContext;rn private LayoutInflater mInflater;rn private List mImageList;rnrn public GalleryAdapter(Context context,List list) rn Log.e("GalleryAdapter",list.toString());rn this.mContext = context;rn this.mImageList = list;rn this.mInflater = LayoutInflater.from(context);rn rnrn public static class ViewHolder extends RecyclerView.ViewHolderrnrn public ViewHolder(View itemView) rn super(itemView);rn rn ImageView mImageView;rnrn rnrn @Overridern public GalleryAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) rn View view = mInflater.inflate(R.layout.productdetail_list_item,parent,false);rn ViewHolder viewHolder = new ViewHolder(view);rn viewHolder.mImageView = (ImageView) view.findViewById(R.id.productdetail_list_image);rnrn return viewHolder;rn rnrn @Overridern public void onBindViewHolder(GalleryAdapter.ViewHolder holder, int position) rn String url = mImageList.get(position);rn if (!url.startsWith(Constants.HOST))rn url = Constants.HOST + url;rnrn RequestQueue mQueue = Volley.newRequestQueue(mContext);rn ImageLoader imageLoader = new ImageLoader(mQueue, BitmapCache.getBitMapCache());rn ImageLoader.ImageListener listener = ImageLoader.getImageListener(holder.mImageView,R.drawable.detail_web_bg,R.drawable.detail_web_bg);rn imageLoader.get(url,listener);rn rn rn @Overridern public int getItemCount() rn return mImageList.size();rn rn[/code]rn求大神帮忙! 论坛

没有更多推荐了,返回首页