如何从视频路径中显示视频缩略图?(how can I show a video thumbnail from a video path?)
我想通过存储上的视频路径在ImageView中显示视频缩略图。 是否有一个函数采用视频路径并返回缩略图的位图? 我通过以下代码获取视频路径:
public ArrayList<String> getAllMedia() { HashSet<String> videoItemHashSet = new HashSet<>(); String[] projection = {MediaStore.Video.VideoColumns.DATA, MediaStore.Video.Media.DISPLAY_NAME}; Cursor cursor = getContext().getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, null); try { cursor.moveToFirst(); do { videoItemHashSet.add((cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)))); } while(cursor.moveToNext()); cursor.close(); } catch(Exception e) { e.printStackTrace(); } ArrayList<String> downloadedList = new ArrayList<>(videoItemHashSet); return downloadedList; }
I want to show a video thumbnail in an ImageView from a video path on storage. Is there a function that takes a video path and returns a bitmap of a thumbnail? I get the video path by this code:
public ArrayList<String> getAllMedia() { HashSet<String> videoItemHashSet = new HashSet<>(); String[] projection = {MediaStore.Video.VideoColumns.DATA, MediaStore.Video.Media.DISPLAY_NAME}; Cursor cursor = getContext().getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, null); try { cursor.moveToFirst(); do { videoItemHashSet.add((cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)))); } while(cursor.moveToNext()); cursor.close(); } catch(Exception e) { e.printStackTrace(); } ArrayList<String> downloadedList = new ArrayList<>(videoItemHashSet); return downloadedList; }
原文:https://stackoverflow.com/questions/50073474
最满意答案
有几种选择:
您可以通过更改设置来使用SnapLines或SnapToGrid :
工具 - >选项 - > Windows窗体设计器 - >常规 - >布局模式(和ShowGrid,SnapToGrid)
请注意,您需要关闭并重新打开设计器才能使更改生效。
或者,您可以通过选择要对齐的对齐并使用“布局”工具栏上的对齐功能来对齐控件。 要显示“布局”工具栏,请右键单击工具栏的空白区域(然后您应该看到一长串可用工具栏),并选中“布局”复选框。
There are a couple of options:
You can use either SnapLines or SnapToGrid by changing settings here:
Tools -> Options -> Windows Forms Designer -> General -> Layout Mode (and ShowGrid, SnapToGrid)
Note, you'll need to close and reopen the designer for the changes to take effect.
Or, you can align controls by selecting the ones you wish to align and using alignment functions on the Layout toolbar. To display the Layout toolbar, right-click on an empty area of your toolbar (you should then see a long list of available toolbars), and check the checkbox for "Layout".
相关问答
更多-
哪里能下载VB.NET或者VS.NET?[2023-11-05]
我因为工作的关系,最近也在找visual studio 2005的安装软件,不过总算找到了。因为我是用WEB迅雷下载软件的,所以在迅雷相关的搜索引擎里面找到的,我把网址告诉你,不过下载下来的软件是试用版的,不过你只要注册一下就可以了,具体方法如下: 下载地址: http://58.61.39.221/down?cid=EA459D0489DCCDBCF362C4BE9341CC97A2D06E92&t=2&fmt=- 安装好之后,用以下方法来注册: 在“添加删除”里面选择删除"visual studio 2 ... -
VS.NET 2010中的异常窗口缺少“用户未处理”列(Exception window in VS.NET 2010 is missing the “User-unhandled” column)[2022-02-11]
我的Visual Studio 2010的安装确实有“用户未处理”列: 编辑 从VS2008调试器不会打破未处理的异常 ... 事实证明,如果您没有在“调试”选项中选中“仅启用我的代码(仅管理)”,“用户未处理”列将不显示在“例外”对话框中。 My installation of Visual Studio 2010 does have the "User-unhandled" column: Edit From VS2008 Debugger does not break on unhandled exc ... -
“待更改”工具窗口。 选择“视图”>“其他Windows”>“待更改”菜单项。 您也可以使用tf status命令,请参阅http://msdn.microsoft.com/en-us/library/9s5ae285.aspx 。 The "Pending Changes" toolwindow. Select the View > Other Windows > Pending Changes menu items. You can also use tf status command, see htt ...
-
Winform - 显示(Winform - Display)[2022-01-19]
听起来像机器之间的不同DPI设置。 当我第一次在Win7中创建一个项目并在WinXP机器上运行它时,我注意到了这一点。 这是一篇SO帖子,描述了这个问题以及如何解决这个问题。 Sounds like different DPI settings between the machines. I noticed this when I first created a project in Win7 and ran it on a WinXP machine. Here is an SO post describ ... -
显示标尺和powerpoint中的网格使用VSTO项目(Dispaly ruler and the grid in powerpoint using VSTO project)[2024-04-28]
您可以使用以下代码行显示网格线: Application.DisplayGridLines = True 我正在看一种显示标尺的方法。 显示标尺的方案是什么? 是否要将按钮添加到显示标尺的自定义功能区? 如果是这种情况,您可以使用RibbonXML在自定义功能区中包含内置的“显示标尺”复选框。 http://msdn.microsoft.com/en-us/library/vstudio/aa942866.aspx You can display the grid lines with this line ... -
在NotExad ++等TextExitor中打开AudioPlayer.csproj,找到Form1.Designer.cs,然后添加DependentUpon节点:
Form1.cs -
有几种选择: 您可以通过更改设置来使用SnapLines或SnapToGrid : 工具 - >选项 - > Windows窗体设计器 - >常规 - >布局模式(和ShowGrid,SnapToGrid) 请注意,您需要关闭并重新打开设计器才能使更改生效。 或者,您可以通过选择要对齐的对齐并使用“布局”工具栏上的对齐功能来对齐控件。 要显示“布局”工具栏,请右键单击工具栏的空白区域(然后您应该看到一长串可用工具栏),并选中“布局”复选框。 There are a couple of options: Yo ...
-
我写了实用工具来手术清理TFS Team Explorer相关的东西。 在CodePlex上托管: http://tfsremover.codeplex.com/ 随意尝试一下。 在我的VS.NET 2010 Ultimate上完美运行。 I've written utility to surgically clean up TFS Team Explorer related stuff. Hosted on CodePlex: http://tfsremover.codeplex.com/ Feel fr ...
-
从MVP Winform Client使用WebAPI的设计模式(Design pattern to consume WebAPI from MVP Winform Client)[2021-12-21]
我通过抽象一切来解决这个问题。 在表示层我会有一个服务抽象... public interface IServiceAgent { TaskGetSomething(string myParameter); } ...从Web API中抽象出我想要的东西。 演示者不需要协调请求。 演示者不关心数据来自何处。 它所知道的是它需要一些东西并要求它(SoC)。 这是服务代理的工作(SRP)。 服务代理实现可能需要调用不同的数据源。 包括网络。 因此,抽象HttpCl ... -
vs.net xsd(vs.net xsd)[2023-12-05]
我相信你最好的选择是将xsd.exe作为预构建事件运行,并将XSD的构建操作设置为“None”。 I believe your best bet would be to run xsd.exe as a pre-build event, and setting the build action for your XSD to "None".