我正在查看Honeycomb Gallery示例代码(此处),并在尝试在我自己的应用程序中添加操作项时遇到以下代码:
<item android:id="@+id/camera"
android:title="Camera"
android:icon="?attr/menuIconCamera"
android:showAsAction="ifRoom" />
Run Code Online (Sandbox Code Playgroud)
这?attr让我陷入了困境.有人可以解释一下这是做什么的吗?这与抽象有什么关系?我似乎无法在Google上找到任何有用的信息.还有一个列表或属性库我们可以用于图标,而不仅仅是menuIconCamera?
谢谢
编辑:我做了一些调查,发现attrs.xml看起来像这样:
<resources>
<declare-styleable name="AppTheme">
<attr name="listDragShadowBackground" format="reference" />
<attr name="menuIconCamera" format="reference" />
<attr name="menuIconToggle" format="reference" />
<attr name="menuIconShare" format="reference" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)
不幸的是,这让我更加困惑.这是做什么的?
所以我对如何做到这一切感到非常困惑,我希望有人可以为我分解一下.
我有一个应该始终运行的服务,并且在某些时候它需要提醒用户任务要完成(可能通过通知栏图标).当用户接受任务时,服务需要查看本地数据库,构造一些非原始对象,并将它们提供给刚刚启动的活动.
我已经看了很多,并且对于一个正确的方法感到非常困惑所以我有几个问题可以帮助我绕过它.
如果活动创建了本地SQLite数据库,那么该应用程序的服务和活动可以在以后访问同一个数据库吗?
服务和活动是否需要在相同或单独的包中?我想不会,但出于某种原因,我记得在其他地方看到过这个.
如何从服务到活动进行数据传输?我在想一个内容提供商,但似乎应该有一种更简单的方法让服务只是交出数据.类似于Intent但非基元.
提前致谢.
我有一个Admob广告的应用程序,但我发现当我使用它时,广告几乎从不刷新,因为我不更改活动,而是我只是在按下按钮时更新文本视图.我试过在谷歌上搜索这个但是一直在努力.
我想告诉应用程序偶尔刷新添加,例如点击两次按钮后或类似的东西.有谁知道如何做到这一点,并可能有一些示例代码?
我在弄清楚如何构建一个Showcase View库的jar时遇到了很多麻烦,以便我可以将它导入到我的应用程序中.
我四处搜索但找不到它的流程.我尝试导入Eclipse,但我不能在那里得到它,因为它不是一个项目,我不确定从源代码创建什么类型的项目.
任何帮助将不胜感激.
我正试图通过小型录音从服务中找到声压级,但Android不会让我访问硬件.我在Logcat中收到以下错误:

该错误来自以下代码:
AudioRecord recordInstance = null;
// We're important...
android.os.Process
.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
short bufferSize = 4096;// 2048;
recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC, this //line 167
.getFrequency(), this.getChannelConfiguration(), this
.getAudioEncoding(), bufferSize); //object not created
tempBuffer = new short[bufferSize];
recordInstance.startRecording();
Run Code Online (Sandbox Code Playgroud)
会发生什么是recordInstance从未正确创建,所以当它到达结尾并调用recordInstance.startRecording()时,recordInstance仍为null.Android在定义中拒绝我的程序请求.有谁知道这些错误表明了什么?我在网上找不到列表.
谢谢
findViewById在ImageView小部件上为我返回null.没有错误,logcat中没有任何内容表明发生了什么.正确设置了id的匹配和其他图像视图.Java和xml由xml中的class标记链接,指向java中定义的类,它是RelativeLayout的后代.
我尝试更改R.id.more_icon1的名称,但这不起作用.尝试清洁,但没有奏效.使用调试器来查看它确实只是移动过去以及何时返回mMoreIcon == null.
什么是奇怪的是,其他ImageView的工作正常.
有人见过这个或有任何想法吗?
Java代码:Class是RelativeLayout的后代
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mText1 = (TextView) findViewById(R.id.text1);
mText2 = (TextView) findViewById(R.id.text2);
mIcon1 = (ImageView) findViewById(R.id.icon1);
mIcon2 = (ImageView) findViewById(R.id.icon2);
// mMoreIcon is the one that gets set as null. mIcon1 and mIcon2 work just fine.
mMoreIcon = (ImageView) findViewById(R.id.more_icon1);
}
Run Code Online (Sandbox Code Playgroud)
XML代码:
<ImageView android:id="@+id/icon1"
style="@style/SuggestionIcon1"
android:scaleType="centerInside"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
/>
<!-- This is the icon that is being returned as null -->
<ImageView android:id="@+id/more_icon1"
style="@style/MoreIcon2"
android:scaleType="centerInside"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:visibility="gone" …Run Code Online (Sandbox Code Playgroud) 我有两个小部件,它们都不会出现在应用程序抽屉中.奇怪的是,如果我从清单中删除一个它也不会出现,但我看不出我做错了什么.从我搜索的所有其他问题看起来是正确的.该应用程序未安装在SD卡上.
有人有主意吗?
AndroidManifest.xml中
<receiver
android:name=".appwidgets.WidgetLarge"
android:label="@string/Widget_large"
android:icon="@drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.groggs.action.CACHE_UPDATE_FINISHED" />
</intent-filter>
<intent-filter>
<action android:name="WIDGET_UPDATE" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_large_info" />
</receiver>
<receiver
android:name=".appwidgets.WidgetSmall"
android:label="@string/Widget_small"
android:icon="@drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.groggs.action.CACHE_UPDATE_FINISHED" />
</intent-filter>
<intent-filter>
<action android:name="WIDGET_UPDATE" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_small_info" />
</receiver>
Run Code Online (Sandbox Code Playgroud)
widget_large_info.xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:maxWidth="450dp"
android:maxHeight="352dp"
android:updatePeriodMillis="0"
android:initialLayout="@layout/widget_layout_large"
android:configure="com.groggs.appwidgets.config.HubQuickViewWidgetConfig" >
</appwidget-provider>
Run Code Online (Sandbox Code Playgroud)
widget_small_info.xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:maxWidth="450dp"
android:maxHeight="82dp" …Run Code Online (Sandbox Code Playgroud) 我对 SSL 及其工作原理有一个大致的了解,但我看到多个应用程序都有诸如“接受所有 SSL 证书”之类的复选框,但我无法理解这到底意味着什么。是否与是否向CA询问是否真实有关?
我问这个问题是因为我目前在登录内部系统时遇到问题,当我选中该框时该系统可以工作但无法工作,我想了解所发生情况背后的技术方面。
我有两个DataGrid表,我想要200px高,但有些东西覆盖了我的CSS高度.目前,这些表格在显示时是两种完全不同的尺寸.
表:
<table dojoType="dojox.grid.DataGrid" id="dnToCountDiv" data-dojo-id="dnToCountDiv" columnReordering="true"
sortFields="['extension','totalcalls','totaloutboundcalls','internaloutboundcalls','localoutboundcalls','longdistanceoutboundcalls','internationaloutboundcalls','totalinboundcalls','inboundinternalcalls','inboundexternalcalls']"
rowWidth="100%"
noDataMessage="<span class='dojoxGridNoData'>No Calls to Show</span>"
class="statisticsTable">
<thead>
<tr>
<th field="extension" width="100%" >Extension</th>
<th field="totalcalls" width="100%" >Total</th>
<th field="totaloutboundcalls" width="100%" > Total Out</th>
<th field="internaloutboundcalls" width="100%" >Internal Out</th>
<th field="localoutboundcalls" width="100%" >Local Out</th>
<th field="longdistanceoutboundcalls" width="100%" >Long Dist Out</th>
<th field="internationaloutboundcalls" width="100%" >Internat. Out</th>
<th field="totalinboundcalls" width="100%" >Total In</th>
<th field="inboundinternalcalls" width="100%" >Internal In</th>
<th field="inboundexternalcalls" width="100%" >External In</th>
</tr>
</thead>
</table>
<!-- dn to call time table -->
<h3>Call Time Per …Run Code Online (Sandbox Code Playgroud) android ×7
admob ×1
attributes ×1
audio ×1
audiorecord ×1
build ×1
css ×1
datagrid ×1
dojo ×1
homescreen ×1
html ×1
service ×1
showcaseview ×1
ssl ×1