Imageview没有显示所有图像(Imageview not showing all image)
您好我正在使用图库在Android应用程序中显示图像。 我在显示图像时遇到问题。 有些图像显示有些不是。
我的适配器代码如下:
ImageView iv; LinearLayout layoutnew = new LinearLayout(getApplicationContext()); layoutnew.setOrientation(LinearLayout.VERTICAL); if (convertView == null) { iv = new ImageView(ctx); iv.setBackgroundDrawable(m_docs_ids[arg0]); iv.setScaleType(ImageView.ScaleType.FIT_XY); int temp =(int) (height/1.7f); int temp_y = (int) ((3*temp)/2.0f); iv.setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT )); } else { iv = (ImageView) convertView; } TextView tv = new TextView(ctx); // tv.setText(m_docs.get(arg0).DocPath); tv.setTextColor(0xFFFFFFFF); tv.setPadding(0, 15, 0, 0); tv.setTag(arg0); tv.setTextSize(18); tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT )); tv.setGravity(Gravity.CENTER); layoutnew.addView(iv); layoutnew.addView(tv); return layoutnew;
m_docs_id是可绘制类型的列表。 我调试它,发现它正在进入正确的。 画廊显示黑色的图像未显示。
我发现放置在DCIM文件夹中的图片没有显示。 显示所有其他图像
Hello i am showing images in android app using gallery. I am having problem in displaying images. Some images are displayed some are not.
My adapter code is as follows:
ImageView iv; LinearLayout layoutnew = new LinearLayout(getApplicationContext()); layoutnew.setOrientation(LinearLayout.VERTICAL); if (convertView == null) { iv = new ImageView(ctx); iv.setBackgroundDrawable(m_docs_ids[arg0]); iv.setScaleType(ImageView.ScaleType.FIT_XY); int temp =(int) (height/1.7f); int temp_y = (int) ((3*temp)/2.0f); iv.setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT )); } else { iv = (ImageView) convertView; } TextView tv = new TextView(ctx); // tv.setText(m_docs.get(arg0).DocPath); tv.setTextColor(0xFFFFFFFF); tv.setPadding(0, 15, 0, 0); tv.setTag(arg0); tv.setTextSize(18); tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT )); tv.setGravity(Gravity.CENTER); layoutnew.addView(iv); layoutnew.addView(tv); return layoutnew;
m_docs_id is a list of drawable type. i have debug it and found that it is getting correct entry. gallery is showing black for images which are not shown.
I found put that pictures placed in DCIM folders are not shown. all other images are shown
原文:https://stackoverflow.com/questions/26928748
满意答案
如果你想获得所有
input
值,你的html
会有一些变化<input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="button" value="Calculate" onclick="Calculate()" />
然后你可以使用像这样的
javascript
function Calculate(){ var inputs = document.getElementsByName("txt"); for(i=0; i<inputs.length; i++) { alert(inputs[i].value); } }
用
jquery
function Calculate(){ $("input[name=txt]").each(function(){ alert($(this).val()); }); }
If you want to get all
input
values, there is a little change with yourhtml
<input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="text" name="txt" value="Insert name"><br/> <input type="button" value="Calculate" onclick="Calculate()" />
Then you can use
javascript
like thisfunction Calculate(){ var inputs = document.getElementsByName("txt"); for(i=0; i<inputs.length; i++) { alert(inputs[i].value); } }
With
jquery
function Calculate(){ $("input[name=txt]").each(function(){ alert($(this).val()); }); }
相关问答
更多HTML:如何制作一个包含文字+图片的提交按钮?(HTML: How to make a submit button with text + image in it?)
提交按钮上的图像[关闭](Image on submit button [closed])
基本提交按钮 - 保存文字[关闭](Basic submit button - save text [closed])
表单提交按钮值[关闭](Form submit button value [closed])
如何在jsp页面上提交和保存按钮?(How to make submit and save button work on jsp page?)
提交按钮不是开火(Submit button not Firing)
提交按钮不响应操作(Submit button not respond for action)
来自$ _POST [关闭]之外的提交按钮的值(Value from submit button outside of $_POST [closed])
提交按钮创建输入文本的HTML文件[关闭](Submit button to create HTML file with text entered [closed])
提交按钮无法在localhost中工作[关闭](submit button not working in localhost [closed])
相关文章
更多C#中Image.FromFile()的用法
《C/C++图像处理编程》扫描版[PDF]
PHP生成带LOGO的二维码图像
如何在jsp中显示数据库的图片
如何在 ListView 中显示 RadioButton???
加载图片时,相同的路径名,用不同的方法时结果却不一样?
比预想严重:FireFox现图像处理漏洞
提交表单,显示遮罩层的问题
HTML5 Canvas 图像动画的实现
Flash图表控件FusionCharts如何高亮显示数据
最新问答
更多您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
在计算机拍照在哪里进入
使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
单页应用程序:页面重新加载(Single Page Application: page reload)
在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!