我想让我的Activity看起来像一个对话框,但没有标题栏.所以我想我应该自己写这个风格.
但是这种XML风格应该如何呢?
我已经为我的Activity尝试过Theme.Dialog,但问题是,我不想要Theme.Dialog风格的背景.没有屏幕标签.我有所有的屏幕构建由XML,我想只是在屏幕上居中,并有一个半透明的外部背景.
我正在开发一个通过JSON消息与服务器通信的应用程序.
发送了一些消息并正确接收了结果.但我的一个例程抛出一个错误,我不确定这是我的问题还是从服务器.
错误是:
org.apache.http.client.HttpResponseException: Internal Server Error
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:71)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:59)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:627)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:616)
at br.com.iba.dao.DLS.post(DLS.java:121)
at br.com.iba.dao.DLS.fulfill(DLS.java:151)
at br.com.iba.LibraryActivity$3.doAction(LibraryActivity.java:123)
at br.com.iba.LibraryActivity$SwitchListener.setSelected(LibraryActivity.java:208)
at br.com.iba.LibraryActivity$SwitchListener.access$0(LibraryActivity.java:204)
at br.com.iba.LibraryActivity$ButtonGroup.onClick(LibraryActivity.java:230)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)
我发布的代码是这样的:
private String post(String json) {
int TIMEOUT_MILLISEC = 10000; // = 10 seconds
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
HttpClient client = new …Run Code Online (Sandbox Code Playgroud) 我正在写一个返回一些数据的C++代码,问题是:每当我从另一个文件调用它时,我的const char都会丢失它的值.我不知道发生了什么.
我在ProcClient.h上的代码
virtual void reportWorkflowError(unsigned int workflow,
const dp::String& errorCode) {
char message[1000];
snprintf(message, 1000, "Workflow: %s ERROR: %s", workflowToString(
workflow).utf8(), errorCode.utf8());
printf("[%s]", message);
errorInfo = message;
}
virtual const char * getErrorInfo() {
return errorInfo;
}
Run Code Online (Sandbox Code Playgroud)
[工作流程:DW_FULFILL错误:E_ADEPT_NO_TOKEN]
[工作流程:错误:E_ADEPT_NOT_READY]
//抛出两个错误,errorInfo应该是最后一个
在Services.cpp上我启动一个"工作流程",如果它抛出一个错误,则调用上面的监听器,之后我应该得到lastError指针.
// g_drmClient是ProcClient
bool RMServices::startFullfilment(dp::String acsm) {
//Do things
g_drmClient->getProcessor()->startWorkflows(dpdrm::DW_FULFILL);
size_t count = g_drmClient->getProcessor()->getFulfillmentItems();
printf("Number of items fulfilled: %d\n", count);
bool returnValue = !g_drmClient->hasError();
if (!returnValue)
lastError = g_drmClient->getErrorInfo());
printf("[%s]", lastError);
return returnValue;
}
Run Code Online (Sandbox Code Playgroud)
在这里它打印:[\æ¾°¯¯¯¯| |æ¾\æ¾er的项目更充分的迭代]
发生了什么?
我正在创建一个layout并在顶部对齐的标题,底部对齐的页脚,并希望视图占用中间的所有剩余可用空间.
如果没有明确地将高度属性传递给每个视图,我该怎么做?
我的实际XML是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
orientation="vertical">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/library_header"
android:scaleType="fitXY" />
<ViewFlipper
android:id="@+id/content"
android:layout_height="0dip"
android:layout_width="match_parent"
android:layout_weight="1.0" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44px"
android:layout_alignParentBottom="true"
android:background="@drawable/library_footer">
<Button
android:id="@+id/l_coverflow"
android:layout_width="44px"
android:layout_height="34px"
android:background="@drawable/library_coverflow_deselected"
android:layout_gravity="center" android:layout_marginLeft="12px" />
<Button
android:id="@+id/l_grid"
android:layout_width="36px"
android:layout_height="32px"
android:background="@drawable/library_grid_deselected"
android:layout_marginLeft="12px"
android:layout_gravity="center"
android:paddingLeft="10px" />
<Button
android:id="@+id/l_list"
android:layout_width="40px"
android:layout_height="32px"
android:background="@drawable/library_list_deselected"
android:layout_marginLeft="12px"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我遇到了一个问题,唯一的解决方案是使用AbsoluteLayout(只是为了在特定的位置展示一些东西).
我正在尝试复制AbsoluteLayout类,以避免在将来的版本中删除它,我的应用程序停止工作.
我正在从这里复制:http://www.google.com/codesearch#cZwlSNS7aEw/frameworks/base/core/java/android/widget/AbsoluteLayout.java&exact_package=android&q=AbsoluteLayout&type=cs
但是获取此代码,首先,我将所有mPadding(Direction)更改为getPadding(Direction),但LayoutParams构造函数仍然存在错误:
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
TypedArray a = c.obtainStyledAttributes(attrs,
com.android.internal.R.styleable.AbsoluteLayout_Layout);
x = a.getDimensionPixelOffset(
com.android.internal.R.styleable.AbsoluteLayout_Layout_layout_x, 0);
y = a.getDimensionPixelOffset(
com.android.internal.R.styleable.AbsoluteLayout_Layout_layout_y, 0);
a.recycle();
}
com.android.internal.R cannot be resolved to a variable
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得这些价值?或者有人已经拥有这个不属于谷歌的类,希望继续使用API?