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);
    }
}

getElementsByName()参考

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 your 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()" />

Then you can use javascript like this

function Calculate(){
    var inputs = document.getElementsByName("txt");
    for(i=0; i<inputs.length; i++)
    {
       alert(inputs[i].value);
    }
}

getElementsByName() Reference

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?)

input type="submit"是在表单中提交提交按钮的最佳方式。 这样做的缺点是你不能把除文本以外的任何东西作为它的值。 按钮元素可以包含其他HTML元素和内容。 尝试在您的button元素( 源 )中type="submit"而不是type="button" 。 请特别注意该页面的以下内容: 如果您在HTML表单中使用按钮元素,则不同的浏览器将提交不同的值。 Internet Explorer将在<button>和</button>标签之间提交文本,而其他浏览器将提交value属性的内容...

提交按钮上的图像[关闭](Image on submit button [closed])

我尝试了你的代码并且它有效,这里是小提琴: https : //jsfiddle.net/268rLw9v/1/ 我认为你的问题是因为图像(或输入)的大小,在我的例子中,我改变了输入的宽度和高度,因为我使用的图像更大。 width: 250px; height: 280px; // I used that because of the image size 确保您的图像具有合适的尺寸。 您还可以尝试使用这些css属性来查看发生的情况: background-size: cover; backgr...

基本提交按钮 - 保存文字[关闭](Basic submit button - save text [closed])

如果你想获得所有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/>...

表单提交按钮值[关闭](Form submit button value [closed])

在你的代码中你打电话 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.

如何在jsp页面上提交和保存按钮?(How to make submit and save button work on jsp page?)

您应该编写另一个javascript函数并将其映射到保存按钮的onclick事件 <td><input type="button" onclick="return saveForm();" value="Save as draft" /></td> 和java脚本方法一样, Java脚本 function saveForm(){ document.form[0].submit; } 在您的servlet中获取属性并显示填充的表单。 希望能帮助到你!! You should write anot...

提交按钮不是开火(Submit button not Firing)

问题:如果您的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{ Tex...

提交按钮不响应操作(Submit button not respond for action)

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...

来自$ _POST [关闭]之外的提交按钮的值(Value from submit button outside of $_POST [closed])

您正在循环中测试Button的字段值 ,但实际上它是您需要测试的字段名称 。 <input type="submit">发送Register的值,这是您在print_r()看到的值。 // Skip the submit button by name, not value if($fields == "Button") { continue; } 如果您有更多提交输入名为Button ,您也可以测试该值,因为只有被点击的那个将被提交给$_POST PHP,尽管这里没有必要。 ...

提交按钮创建输入文本的HTML文件[关闭](Submit button to create HTML file with text entered [closed])

我不会用我已经完成的调试重新输入我的意见。 以下是最终代码应该读作的内容,并且您修复了HTML标记中的一些错误。 HTML <!doctype html> <head> <title>Cafe Menu Creator</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="cafe.css" /> <...

提交按钮无法在localhost中工作[关闭](submit button not working in localhost [closed])

您没有开始<form method="">来关闭</form> 将其添加到您的实际表单上方。 例: <form method="POST"> <tr><td>User Name: </td> <td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td> You do not have an opening <form...

相关文章

更多

C#中Image.FromFile()的用法

谁能告诉我这个方法的具体用法我是这样写的Image.FromFile(&quot;1.jpg&quot ...

《C/C++图像处理编程》扫描版[PDF]

中文名: C/C++图像处理编程 作者: 陆宗骐 图书分类: 网络 资源格式: PD ...

PHP生成带LOGO的二维码图像

清远大学城网(http://www.qydxc.com) 现在二维码是我们一些软件站或下载站常用的一种 ...

如何在jsp中显示数据库的图片

图片在数据库中以连接&lt;image src=&quot;&quot;&gt;的方式存在.. 我可 ...

如何在 ListView 中显示 RadioButton???

因为看到可以在 ListView 中显示 ImageView, TextView, Checkbox ...

加载图片时,相同的路径名,用不同的方法时结果却不一样?

用URL imageUrl = MyText.class.getResource(&quot;/res ...

比预想严重:FireFox现图像处理漏洞

研究人员表示,在Firefox 1.5.0.3中发现的新隐患可能会导致拒绝服务攻击。这个漏洞由于浏览器 ...

提交表单,显示遮罩层的问题

最近初开始学习jquery,想尝试做一个效果,就是提交页面上的一个表单,点击提交按钮(submit类型 ...

HTML5 Canvas 图像动画的实现

内容摘要:Canvas 中 clearRect 清除函数;setInterval与clearInter ...

Flash图表控件FusionCharts如何高亮显示数据

使用Flash图表控件FusionCharts时,通过改变alpha值是高亮显示数据的最简单方式。

最新问答

更多

您如何使用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?)

将diff文件复制到存储库的根目录,然后执行以下操作: git apply yourcoworkers.diff 有关apply命令的更多信息, apply 见其手册页 。 顺便说一下:一个更好的方法是通过文件交换整个提交文件是发送者上的命令git format-patch ,然后在接收器上加上git am ,因为它也传送作者信息和提交信息。 如果修补程序应用程序失败,并且生成diff的提交实际上在您的备份中,则可以使用尝试在更改中合并的apply程序的-3选项。 它还适用于Unix管道,如下

将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)

尝试将第二行更改为snprintf(buf1, sizeof buf1, "%.2f", balance1); 。 另外,为什么要声明用该特定表达式分配缓冲区的存储量? EDIT @LưuVĩnhPhúc在下面的评论中提到我的原始答案中的格式说明符将舍入而不是截断,因此根据如何在不使用C舍入的情况下截断小数,您可以执行以下操作: float balance = 200.56866; int tmp = balance1 * 100; float balance1 = tmp / 100.0; c

OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)

这是简单的解决方案 在你需要写的控制器中 BackendMenu::setContext('Archetypics.Team', 'website', 'team'); 请参阅https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code'); 你需要在r

页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)

每当发出请求时ASP都会创建一个新的Page对象,并且一旦它将响应发送回用户就不会保留对该Page对象的引用,因此只要你找不到某种方法来保持生命自己引用该Page对象后,一旦发送响应, Page和只能通过该页面访问的所有对象才有资格进行垃圾回收。 ASP creates a new Page object whenever a request is made, and it does not hold onto the reference to that Page object once it

codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)

要在生产服务器中调试这个,你可以临时放 error_reporting(E_ALL); 并查看有哪些其他错误阻止正确的重定向。 您还应该检查生产服务器发送的响应标头。 它是否具有“缓存”,是否需要重新验证标头等 to debug this in production server, you can temporary put error_reporting(E_ALL); and see what other errors are there that prevents the proper

在计算机拍照在哪里进入

打开娥的电脑.在下面找到视频设备点击进去就可以了...

使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)

你是对的。 第一次输入后,换行符将保留在输入缓冲区中。 第一次读取后尝试插入: cin.ignore(); // to ignore the newline character 或者更好的是: //discards all input in the standard input stream up to and including the first newline. cin.ignore(numeric_limits::max(), '\n'); 您必须为#inc

No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)

for (int k = 0; k > 10; k++) { System.out.println(k); } k不大于10,所以循环将永远不会执行。 我想要什么是k<10 ,不是吗? for (int k = 0; k < 10; k++) { System.out.println(k); } for (int k = 0; k > 10; k++) { System.out.println(k); } k is not greater than 10, so loop

单页应用程序:页面重新加载(Single Page Application: page reload)

优点是不注销会避免惹恼用户,以至于他们会想要杀死你:-)。 说真的,如果每次刷新页面时应用程序都会将我注销(或者在新选项卡中打开一个链接),我再也不会使用该应用程序了。 好吧,不要这样做。 确保身份验证令牌存储在刷新后的某个位置,即不在某些JS变量中,而是存储在cookie或本地存储中。 The advantage is that not logging off will avoid pissing off your users so much that they'll want to kill

在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)

EXECUTE IMMEDIATE 'SELECT '||field_val_temp ||' FROM tableb WHERE function_id = :func_val AND rec_key = :rec_key' INTO field_val USING 'STDCUSAC' , yu.rec_key; 和, EXECUTE IMMEDIATE 'UPDATE tablec SET field_val_'||i||' = :field_val' USI