首页 \ 问答 \ android布局问题(android layout problem)

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 and

HttpResponse response = androidClient.execute(httppost);

If you need more info about JSON request there are many tutorials.

相关问答

更多
  • 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 ...
  • 定义具有有意义(对于美国案例)方法的服务接口。 让客户端提供一个ResponseHandler,而不是使用阻塞调用,该操作完成后将调用它: interface ResponseHandler { void onComplete(Response response); void onError(Throwable error); } interface SomeService { void set(String attribute, Object value, ResponsHandler ...

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)