我最近又遇到了一个问题,我在过去几年里曾多次遇到这个问题.
LinearLayout很方便layout manager.但我完全错过的是在单个XML标记中添加元素之间的某个空间(如填充)的可能性.
我的意思是,我可以在LinearLayout的声明中定义元素之间的间距(例如,在垂直LinearLayout中,这个布局中两个元素之间的垂直空间).
我知道我可以通过添加XML标签android:layout_marginTop或类似于LinearLayout中每个元素的东西来实现.
但我希望能够在一个点上定义它,因为所有元素的间距都是相同的.
有没有人知道一个简单的方法(不实现自定义LinearLayout或类似的东西)?我更喜欢直接在XML中工作而无需编码的解决方案.
有人知道Android上的ProcessKiller进程吗?看来它杀死了我的应用程序,因为它有一个打开的文件。当我将文件下载到 SD 卡,然后在下载过程中拔出卡时,就会发生这种情况。这就是 logcat 所说的。
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
E/ProcessKiller( 2447): Process com.example.myapp (24090) has open file /storage/sda1/MyRecordings/81321226.recording/downloading/00000149.ts
Run Code Online (Sandbox Code Playgroud)
我无法正确关闭该文件,因为它是我下载的临时文件,当用户在下载过程中拔出 SD 卡时会发生这种情况。所以我无法再访问该文件,因此无法关闭 …
我为硕士论文编写了一个适用于Android 3.1的Motorola Xoom平板电脑的应用程序,该应用程序可以使用其相机实时扫描多个QR码,并通过识别的QR码在显示屏上显示其他信息。
识别是通过ZXing安卓应用(http://code.google.com/p/zxing/)完成的,我基本上只是更改了ZXing应用的代码,以便它可以同时识别多个QR码,并且可以连续进行此扫描,而不会像原始应用一样成功扫描后冻结。因此,我的应用程序基本上是ZXing应用程序,可以连续扫描多个QR码。
但是我面临一个问题:
ZXing应用程序进行某种连续的自动对焦。它会启动自动对焦,完成后会再次自动启动自动对焦。但是这种方法会以某种方式使相机的亮度设置太亮,从而使相机无法识别QR码,因为图像几乎是全白的。禁用自动对焦可以解决该问题,但是我需要自动对焦,因为否则只能在一定距离下才能识别QR码。