android布局问题(android layout problem)
我希望行自动缩放。 我的代码的效果真的很奇怪......
我无法发布图片,所以图片在这里: http : //i.stack.imgur.com/NQfkO.jpg
代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#FFFFF0"
>
<TextView android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="60dip" android:gravity="center_vertical" android:textSize="25sp" android:textColor="#CBCBCB" /> <TextView android:id="@+id/label" android:minHeight="60dip" android:maxHeight="120dip" android:layout_width="220dip" android:layout_height="wrap_content" android:layout_marginLeft="5dip" android:gravity="center_vertical" android:textSize="25sp" android:textColor="#0f93b8" /> <TextView android:id="@+id/people" android:layout_width="fill_parent" android:layout_height="60dip" android:gravity="right" android:textSize="12sp" android:textColor="#CBCBCB" /> </LinearLayout>
I want the row to be scale automatically. The effect of my code is really strange...
i can't post images, so image is here: http://i.stack.imgur.com/NQfkO.jpg
the code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#FFFFF0"
>
<TextView android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="60dip" android:gravity="center_vertical" android:textSize="25sp" android:textColor="#CBCBCB" /> <TextView android:id="@+id/label" android:minHeight="60dip" android:maxHeight="120dip" android:layout_width="220dip" android:layout_height="wrap_content" android:layout_marginLeft="5dip" android:gravity="center_vertical" android:textSize="25sp" android:textColor="#0f93b8" /> <TextView android:id="@+id/people" android:layout_width="fill_parent" android:layout_height="60dip" android:gravity="right" android:textSize="12sp" android:textColor="#CBCBCB" /> </LinearLayout>
原文:https://stackoverflow.com/questions/3974891
更新时间:2022-08-31 16:08
最满意答案
你必须用适当的形式制作JSON
JSONArray params = new JSONArray(); params.put(""); params.put(""); .... JSONObject rpcCall = new JSONObject(); rpcCall.put("method", METODNAME); rpcCall.put("params", params); rpcCall.put("id", 1);
并使用
HttpPost httppost
和发送到服务器HttpResponse response = androidClient.execute(httppost);
如果您需要有关JSON请求的更多信息,那么有许多教程。
You have to make JSON in the appropriate form with something like
JSONArray params = new JSONArray(); params.put(""); params.put(""); .... JSONObject rpcCall = new JSONObject(); rpcCall.put("method", METODNAME); rpcCall.put("params", params); rpcCall.put("id", 1);
and send it to the server with
HttpPost httppost
andHttpResponse response = androidClient.execute(httppost);
If you need more info about JSON request there are many tutorials.
相关问答
更多-
了解Perl中的JSON-RPC(Understanding JSON-RPC in Perl)[2023-01-20]
HTML页面中的按钮是否位于标记内(就像我们通常在基于CGI的程序中那样)? 如果是,那该调用什么文件?* 如果不是,那么如何传递要添加的值? HTML与JSON-RPC没有任何关系。 虽然RPC调用是通过HTTP POST请求完成的,但如果您是从浏览器执行此操作,则需要使用XMLHttpRequest(即:AJAX)。 取消链接HTML表单后, Content-encoding:标头将需要特定于JSON-RPC(例如:application / json或类似),并且您需要通过JSON.stringify ... -
JSON-RPC是JSON远程过程调用,默认情况下是面向过程的。 但是,如果您在HTTP上工作,则可以将每个RPC服务视为对象。 即如果您通过HTTP访问/foo/bar并通过JSON-RPC调用beep ,则调用bar对象的foo服务的beep方法。 否则,您可以按照过程调用映射的所有OOP的方式执行此操作: foo.bar(x1,x2) -> bar(foo,x1,x2) 其中foo是对象的“指针”,对于RPC,它可能是对象UUID。 (这就是在某些RPCS中实际完成的方式)。 所以你打电话 f=n ...
-
原来#(&* $文档错了,我得到404的原因是因为网址没有 http://host:port/confluence/rpc/json-rpc/confluenceservice-v2 但 http://host:port/rpc/json-rpc/confluenceservice-v2 所以..我得到了404因为...它是404.代码工作得很好,除了我必须为application / json添加内容类型头。 Turns out the #(&*$ documentation was wrong an ...
-
你必须用适当的形式制作JSON JSONArray params = new JSONArray(); params.put(""); params.put(""); .... JSONObject rpcCall = new JSONObject(); rpcCall.put("method", METODNAME); ...
-
你的代码似乎很好。 但在请求中, params应该是一个包含实际参数的数组。 尝试使用以下有效负载,它应该工作: { "jsonrpc":"2.0", "method":"Arithmetic.Multiply", "params": [ { "A": 5, "B": 6 } ], "id":1 } (注意包含实际参数的“[”和“]”) Your code seems fine. But in the request, params is expected to be an ar ...
-
根据我对JSON-RPC 规范和示例的理解, 多次请求和响应可能比多次定义POST端点更有效。 # My API ## JSON-RPC [/endpoint] ### Doing something [POST] + Request Sum of numbers (application/json-rpc) {"method": "sum", "params": {"a":3, "b":4}, "id":0} + Response 200 (application/json-rpc ...
-
将数据作为“正常”帖子而不是json字符串发布。 要将数组转换为要与curl和CURLOPT_POSTFIELDS一起使用的后期数据,可以使用http_build_query()方法。 例: $post_info = http_build_query(array( "jsonrpc" => "2.0", "method" => "get", "id" => 1, "params" => array( "2145359" ) )); ...
-
由于网络条件的原因,您可能无法一次性下载300kb的EDGE。 您可以做的是通过HTTP Range标头恢复下载。 浏览器使用它来恢复取消或中断的下载。 当然,您的服务器必须支持此功能。 在标题列表中查找Range : http : //en.wikipedia.org/wiki/List_of_HTTP_headers#Requests It's possible that you'll not be able to download 300kb in one go on EDGE because of ...
-
我想你应该试试http-kit 。 你还需要一些json库( data.json或cheshire ) 所以添加到您的project.clj以下依赖项: [http-kit“2.1.18”] [org.clojure / data.json“0.2.6”] 试试吧 (ns your-ns (:require [org.httpkit.client :as http] [clojure.data.json :as json])) (let [url "http://localho ...
-
使用底层请求/响应协议实现RPC(SIP上的JSON-RPC)(Implement RPC with underlying request/response protocol (JSON-RPC on SIP))[2022-02-27]
定义具有有意义(对于美国案例)方法的服务接口。 让客户端提供一个ResponseHandler,而不是使用阻塞调用,该操作完成后将调用它: interface ResponseHandler { void onComplete(Response response); void onError(Throwable error); } interface SomeService { void set(String attribute, Object value, ResponsHandler ...