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
更新时间:2023-07-31 06:07
最满意答案
如果你想获得所有
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()); }); }
相关问答
更多-
input type="submit"是在表单中提交提交按钮的最佳方式。 这样做的缺点是你不能把除文本以外的任何东西作为它的值。 按钮元素可以包含其他HTML元素和内容。 尝试在您的button元素( 源 )中type="submit"而不是type="button" 。 请特别注意该页面的以下内容: 如果您在HTML表单中使用按钮元素,则不同的浏览器将提交不同的值。 Internet Explorer将在标签之间提交文本,而其他浏览器将提交value属性的内容。 使用输 ...
-
提交按钮上的图像[关闭](Image on submit button [closed])[2019-11-27]
我尝试了你的代码并且它有效,这里是小提琴: https : //jsfiddle.net/268rLw9v/1/ 我认为你的问题是因为图像(或输入)的大小,在我的例子中,我改变了输入的宽度和高度,因为我使用的图像更大。 width: 250px; height: 280px; // I used that because of the image size 确保您的图像具有合适的尺寸。 您还可以尝试使用这些css属性来查看发生的情况: background-size: cover; background- ... -
如果你想获得所有input值,你的html会有一些变化
表单提交按钮值[关闭](Form submit button value [closed])[2023-05-01]
在你的代码中你打电话 document.myform.submit(); 当您以这种方式触发表单提交时,您不会收到提交按钮。 In your code you call document.myform.submit(); You are not going to get a submit button when you trigger the form submission that way.您应该编写另一个javascript函数并将其映射到保存按钮的onclick事件和java脚本方法一样, Java脚本 function saveForm(){ document.form[0].submit; } 在您的servlet中获取属性并显示填充的表单。 希望能帮助到你!! You should write another j ... 提交按钮不是开火(Submit button not Firing)[2023-06-21]
问题:如果您的Region cookie为null ,则不会插入任何默认值。 解决方案:如果Region Cookie变为null则需要添加Default值。 你需要添加else块来存储默认值asbelow 尝试这个: if (Request.Cookies["Region"] != null) { TextBox5.Text = Server.HtmlEncode(Request.Cookies["Region"].Value);//read cookie } else{ TextBox5 ...提交按钮不响应操作(Submit button not respond for action)[2023-05-31]
function save_contact_information() { alert("ok1"); document.getElementById('User_Finder').action ="Controler/controller_page.php?button=save_contact_information"; alert("ok2"); document.getElementById('User_Finder').submit(); //here form ...您正在循环中测试Button的字段值 ,但实际上它是您需要测试的字段名称 。 发送Register的值,这是您在print_r()看到的值。 // Skip the submit button by name, not value if($fields == "Button") { continue; } 如果您有更多提交输入名为Button ,您也可以测试该值,因为只有被点击的那个将被提交给$_POST PHP,尽管这里没有必要。 if($f ...我不会用我已经完成的调试重新输入我的意见。 以下是最终代码应该读作的内容,并且您修复了HTML标记中的一些错误。 HTMLCafe Menu Creator 您没有开始 将其添加到您的实际表单上方。 例: