我需要从Android上的视频文件中读取元数据.我已经看过通过MediaStore.Video.VideoColumns和android.media.MediaMetadataRetriever提供的标签.但是,这两个都不能让我访问一些额外的标签,而像Phil Harvey这样的ExifTool工具可以访问这些标签.
我最感兴趣的是Camera Make/Model,Compressor ID标签,但我真的很想知道如何访问其他标签.
android中是否存在用于读取这些附加标记的API,或者我是否正在考虑自己实现特定于文件格式的本机元数据解析器?
这里是ExifTool为使用iPhone相机拍摄的视频生成的输出:
ExifTool Version Number : 9.28
File Name : iPhone.MOV
Directory : .
File Size : 74 kB
File Modification Date/Time : 2013:04:30 14:41:24+09:00
File Access Date/Time : 2013:04:30 14:41:24+09:00
File Creation Date/Time : 2013:04:30 14:41:24+09:00
File Permissions : rw-rw-rw-
File Type : MOV
MIME Type : video/quicktime
Major Brand : Apple QuickTime (.MOV/QT)
Minor Version : 0.0.0
Compatible Brands : qt
Movie Data Size : …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,它使用以下样式为应用程序主题绘制自定义标题栏:
<style name="App_Theme" parent="android:Theme">
<item name="android:windowTitleSize">30dip</item>
<item name="android:windowTitleBackgroundStyle">@style/App_TitleBackground</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这并没有给我全息主题.所以我设置为parent ="@ android:style/Theme.Holo".这会使应用程序崩溃并出现以下错误:
E/AndroidRuntime(2048):引起:android.util.AndroidRuntimeException:您无法将自定义标题与其他标题功能组合使用
是否禁止使用自定义标题栏:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
Run Code Online (Sandbox Code Playgroud)
或者我在这里遗漏了什么?
PS:
我正在使用自定义属性在我的应用程序中实现主题切换.我定义了以下属性:
<resources>
<attr name="TextAppearance_Footer" format="reference"></attr>
</resources>
Run Code Online (Sandbox Code Playgroud)
我有两个主题,以不同的方式定义此属性:
<style name="NI_AppTheme.Dark">
<item name="TextAppearance_Footer">@style/Footer</item>
</style>
Run Code Online (Sandbox Code Playgroud)
的@style/Footer定义如下:
<style name="Footer" parent="@android:style/TextAppearance.Large">
<item name="android:textColor">#00FF00</item> // Green
</style>
Run Code Online (Sandbox Code Playgroud)
现在,如果我尝试将此样式设置为TextView使用:
textView.setTextAppearance(this, R.attr.TextAppearance_Footer);
Run Code Online (Sandbox Code Playgroud)
它不起作用(即不将文本设置为绿色).但是,如果我使用xml通过xml指定文本外观:
android:textAppearance="?TextAppearance_Footer"
Run Code Online (Sandbox Code Playgroud)
它工作正常.我能错过什么?我需要设置属性,因为我想动态地在主题之间切换.
附加信息:
如果我使用:
textView.setTextAppearance(this, R.style.NI_AppTheme.Dark);
Run Code Online (Sandbox Code Playgroud)
它似乎工作正常.
编辑:经过测试的工作解决方案(感谢@nininho):
Resources.Theme theme = getTheme();
TypedValue styleID = new TypedValue();
if (theme.resolveAttribute(R.attr.Channel_Title_Style, styleID, true)) {
channelTitle.setTextAppearance(this, styleID.data);
}
Run Code Online (Sandbox Code Playgroud) 我使用:after伪元素在一个块(<li>以我为例)之后显示一个装饰(三角形)。这个想法是要区分当前选择li的其他人。
的HTML如下:
<ul>
<li class="active" style="background-color: hsl(108, 60%, 50%)">One</li>
<li style="background-color: hsl(36, 60%, 50%)">Two</li>
<li style="background-color: hsl(252, 60%, 50%)">Three<li>
</ul>
Run Code Online (Sandbox Code Playgroud)
和CSS:
ul li {
width: 300px;
height: 30px;
border: 1px dashed;
position: relative;
}
li.active::after {
content: " 0020";
display: block;
font-size: 0px;
position: absolute;
left:100%;
top: 0%;
width: 0px;
height: 0px;
background: transparent;
border: 17px solid transparent;
border-left-color: #FF3900;
}
Run Code Online (Sandbox Code Playgroud)
我想更改伪元素的border-left-color样式属性,li.active::after以background-color将<li>元素与匹配class=active。
我想出了以下jQuery: …
我正在尝试创建具有主键的表,该主键是定义为binary(16)而不是默认自动递增id字段的 UUID 。
我已经设法使用原始 SQL 语句创建迁移,但DB::statement如下所示:
DB::statement("CREATE TABLE `binary_primary_keys` (
`uuid` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
Run Code Online (Sandbox Code Playgroud)
但是,我无法使模型正常工作。我已按照此处提供的教程进行操作。我已经这样定义了我的模型:
class UuidModel extends Model
{
public $incrementing = false;
public $primaryKey = 'uuid';
/**
* The "booting" method of the model.
*
* @return void
*/
protected static function boot()
{
parent::boot();
/** …Run Code Online (Sandbox Code Playgroud) 我有一个垂直方向的线性布局,我在其中插入了几个视图组。其中之一是:
<LinearLayout
android:id="@+id/addedit_updowncontrol"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<Button
android:id="@+id/addedit_btndecrement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_weight="0.1"
android:text="-" />
<EditText
android:id="@+id/addedit_txtQuantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="90dp"
android:layout_weight="0.4"
android:layout_alignParentTop="true"
android:inputType="numberDecimal" />
<Button
android:id="@+id/addedit_btnIncrement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_weight="0.1"
android:layout_toLeftOf="@+id/addedit_units"
android:text="+" />
<Spinner
android:id="@+id/addedit_units"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这给了我一个看起来像这样的视图(为链接道歉,我希望有更好的方法)。这是不可接受的,因为 Button 与 EditText 不对齐。
我试图切换到RelativeLayout的,这给了我像这样。这是不可接受的,因为两个按钮 (-) 和 (+) 的宽度不同。
我想我想要实现的是: (1) Button 的基线与行中的其他控件对齐。(2) 两个按钮的宽度相同。
我似乎能够实现(1)使用RelativeLayout和(2)使用LinearLayout。但不能两者兼而有之。
有人可以帮我吗?
我正在研究针对典型生产者/消费者问题的Qt特定C++ 解决方案.这是生产者的代码:
class Producer : public QThread
{
public:
void run()
{
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
for (int i = 0; i < DataSize; ++i) {
freeBytes.acquire(); // (1)
buffer[i % BufferSize] = "ACGT"[(int)qrand() % 4]; // (2)
usedBytes.release();
}
}
};
Run Code Online (Sandbox Code Playgroud)
我无法理解for循环中的第二行即."ACGT"[*]句法.它究竟做了什么?这个Qt是特定的还是我不知道的这个C++语法?
PS:这里有完整的源代码
昨天我再次安装了ADT插件,因为我遇到了问题(间歇性)和我已有的版本.问题是,我没有在我的所有xml资源中收到警告.我很确定我以前没有看过它们.其中一些令人讨厌,因为我无法做任何事情:
Nested weights are bad for performance
The resource R.attr.TextAppearance_Group_Small appears to be unused
Replace "..." with ellipsis character (…, …)?
Run Code Online (Sandbox Code Playgroud)
我必须解决的其他问题包括:
This tag and its children can be replaced by one <TextView/> and a compound drawable
[Accessibility] Missing contentDescription attribute on image
Run Code Online (Sandbox Code Playgroud)
有没有办法压制这些警告?我们有零容忍政策,不允许我们签署警告代码?
所以,我只是将AdMob集成到我的应用程序中.现在,我想知道是否将广告放在屏幕顶部或底部.
在美学上,我认为应用程序看起来更好用屏幕底部的广告.
然而,我的小魔鬼认为,如果我把它们置于顶部,那么人们更有可能错误地点击广告(从而增加了我的点击次数),因为那是我有动作栏的地方.
当然,无论我在哪里放置,真正想要点击广告的人都会点击它们.
谁能分享他们在这方面的经验?
我正在使用jquery JSON.parse()来解析json从api(Laravel 5)返回的那个$.get().在json似乎是有效的,但是,JSON.parse()在Safari和Chrome浏览器返回错误.
Chrome说:
Uncaught SyntaxError: Unexpected token o
Run Code Online (Sandbox Code Playgroud)
Safari说:
SyntaxError: JSON Parse error: Unexpected identifier "object"
Run Code Online (Sandbox Code Playgroud)
代码片段如下:
$.get('/foo/' + product_id, function(data){
console.log(data);
var product = JSON.parse(data);
if (product) {
// do something
}
});
Run Code Online (Sandbox Code Playgroud)
JSON是:
{
"id":"1b7b3eb7-8769-48fe-a421-64c105de3eff",
"parent":null,
"org_id":"845d0d53-de68-42c3-9007-c3d0e72c555e",
"category_id":"e58237f7-e040-4098-8d46-b84f8cdf7d83",
"purchase_tax":null,
"sale_tax":null,
"code":"982",
"name":"Mr. Destin Hoppe",
"is_purchased":false,
"is_sold":false,
"purchase_price":null,
"selling_price":null,
"purchase_includes_tax":false,
"sale_includes_tax":false,
"created_at":"2015-09-16 17:39:34",
"updated_at":"2015-09-16 17:39:34"
}
Run Code Online (Sandbox Code Playgroud)
有趣的是,eval()工作得很好.