小编Eli*_*nja的帖子

当列表只有一个元素时,CXF返回对象而不是js数组

我正在使用CXF来创建宁静的服务.其中一个服务返回一个字符串列表.当我在列表中有多个项目时,CXF返回一个字符串数组,但是当我只有一个元素时,它返回String而不是带有json的数组:

有一个项目:

 {"ImageResponse":{"images":"hello"}}
Run Code Online (Sandbox Code Playgroud)

有两个项目:

 {"ImageResponse":{"images":["hello","hi"]}}
Run Code Online (Sandbox Code Playgroud)

有没有办法总是返回一个列表,即使列表只有一个项目?

我的Response类:

@XmlRootElement
public class ImageResponse {
private List<String> images;
//getter and setter
}
Run Code Online (Sandbox Code Playgroud)

json web-services cxf

4
推荐指数
1
解决办法
4886
查看次数

android:layout_weight with vertical linearlayout

我正在尝试创建一个Android布局,如:

[####的EditText ###] [按钮]

[####列表显示#####]

为此,我正在使用重量,但下面的xml给了我一些非常类似的东西:

[EDITTEXT] [按钮] [ListView的]

有人知道为什么吗?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/background"
    android:weightSum="10"
     >

    <EditText android:id="@+id/nova_lista"
        android:inputType="text"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="9"
        android:hint="@string/new_list_hint">

    </EditText>

    <Button android:id="@+id/nova_lista_botao"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:text="@string/new_list"/>

    <ListView
        android:id="@+id/list_of_lists"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    </ListView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

xml layout android

0
推荐指数
1
解决办法
9730
查看次数

标签 统计

android ×1

cxf ×1

json ×1

layout ×1

web-services ×1

xml ×1