我的布局几乎可以满足我的需求.关于底部按钮只有一个错误.我应该一直呆在最底层.但每当我调出软键盘时,按钮都会显示在键盘上方.这不是我想要的,但它应该被键盘覆盖.
此外,如果您可以评论布局的构建方式,我会很高兴.
谢谢,斯蒂夫
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout android:id="@+id/l_layout_tags"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="TAGS:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<AutoCompleteTextView android:id="@+id/actv_tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:imeOptions="actionDone" />
<ImageButton android:id="@+id/btn_add_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_input_add"
android:onClick="addTag"/>
</LinearLayout>
<ScrollView android:id="@+id/sv_scroll_contents"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/l_layout_tags"
android:scrollbarFadeDuration="2000" >
<TableLayout android:id="@+id/t_layout_contents"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:paddingRight="5dip">
<TableRow android:id="@+id/tr_template">
<ImageView android:id="@+id/iv_blank"
android:src="@android:color/transparent" />
<EditText android:id="@+id/et_content1"
android:gravity="top"
android:maxWidth="200dp"
android:imeOptions="actionDone" />
</TableRow>
</TableLayout>
</ScrollView>
<LinearLayout android:id="@+id/l_layout_media_btns"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
android:layout_below="@id/sv_scroll_contents" >
<ImageButton android:id="@+id/btn_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera"
android:onClick="takePicture" />
<ImageButton android:id="@+id/btn_video" …Run Code Online (Sandbox Code Playgroud) 我正在努力建立一个在不同进程中运行的Activity和Service之间的双向通信.
从Activity中查询进程没什么大不了的.但我希望该过程通知活动事件.它背后的想法是:服务独立于实际的应用程序运行.它定期查询Web服务器.如果在Web服务器上找到新任务,则该进程应通知该活动.
我在AndDev.org上找到了这个帖子,但它似乎对我不起作用.我一直在搞乱BroadcastReceiver.我已经实现了一个应该通知Activity的接口,但问题是监听器总是为null,因为进程的Broadcast是通过Intent完成的,因此扩展BroadcastReceiver的类将被新实例化.
如何建立双向通信?这必须是可能的.谢谢你的帮助,
steff
模拟器的相机在2.1 Eclair拍照时效果很好.显然,没有用的是录制视频.
现在运行的应用程序仅在2.1 Emulator上完美无缺,导致相机应用程序崩溃.我启动了启动它的意图:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(TEMP_PHOTO_FILE)));
startActivityForResult(intent, REQUEST_CAMERA);
Run Code Online (Sandbox Code Playgroud)
这启动了相机应用程序,但几秒钟后它崩溃了.输出是:
06-01 09:57:15.593: DEBUG/libEGL(5212): egl.cfg not found, using default config
06-01 09:57:15.593: DEBUG/libEGL(5212): loaded /system/lib/egl/libGLES_android.so
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): FATAL EXCEPTION: GLThread 11
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): java.lang.IllegalArgumentException: No configs match configSpec
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:760)
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:916)
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1246)
06-01 09:57:15.733: ERROR/AndroidRuntime(5212): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
Run Code Online (Sandbox Code Playgroud)
实际上我只是想知道是否已经在FroYo中修复了即使指定了EXTRA_OUTPUT而使您从相机接收到小图像的错误.不幸的是,我甚至没有测试它.
有没有人遇到类似的问题?
谢谢,
斯蒂夫
我在构建我的第一个 XML 模式时遇到了相当大的困难。我需要它来验证形成问卷的 XML 文档的正确性。
所以这里是不要得到的部分:
我改变了来源。第一个答案是指此代码:
<root>
<values>
<value>Lorem</value>
<value>ipsum</value>
<value>dolor</value>
</values>
</root>
Run Code Online (Sandbox Code Playgroud)
现在我的实际目标是这样的:
<requires>
<require requires-id="2" type="included">
<values>
<value isRequired="true">Lorem</value>
<value isRequired="false">Lorem</value>
<value isRequired="false">Lorem</value>
</values>
</require>
<require requires-id="5" type="excluded">
<values>
<value isRequired="true">Lorem</value>
<value isRequired="false">Lorem</value>
</values>
</require>
</requires>
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮忙制作一个合适的架构吗?我正在使用Sun Multi-Schema XML Validator (MSV)根据 Schema 验证文档。
提前致谢,
史蒂夫
我想知道为什么具有2.1-update1的摩托罗拉里程碑与仿真器或Nexus One的行为不同.我试图退出我的应用程序:
@Override
protected void onPause() {
if(mayDestroyActivity) this.finish();
super.onPause();
}
Run Code Online (Sandbox Code Playgroud)
这适用于模拟器或Nexus One.onDestroy()在onPause()和之后立即被称为onStop.但不是里程碑.而是onDestroy()在启动另一个Activity时调用.它在Manifest中的部分看起来像这样:
<activity android:name=".MyActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/questionnaire_item"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
有人对此有暗示吗?我的应用程序取决于正确退出,因为我保存了所有进度onDestroy()
谢谢,
斯蒂夫
我相信这会得到回答,但事实证明我无法找到它.所以请原谅我的冗余.
我想要做的是模仿"Home"按钮,它将一个回到Android的主屏幕.所以这就是导致我出现问题的原因:
对于问卷调查应用程序,我使用单个活动(称为ItemActivity)调用自身(在使用意图时也是递归吗?)从一个问题跳转到另一个问题:
Questionnaire.serializeToXML();
Intent i = new Intent().setClass(c, ItemActivity.class);
if(Questionnaire.instance.getCurrentItemNo() == Questionnaire.instance.getAmountOfItems()) {
Questionnaire.instance.setCompleted(true);
} else Questionnaire.instance.nextItem();
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
最后一个屏幕显示的内容类似于"感谢您参与"以及之前描述的按钮,该按钮应该返回到主屏幕.但我真的没有得到如何正确退出活动.我已经使用了,this.finish();但这又奇怪地再次打开了"谢谢"屏幕.那么我怎样才能通过跳回主屏幕退出?
很抱歉给您带来不便.
此致,
Steff