【发布时间】:2014-02-25 05:35:12
【问题描述】:
在我的 Android 应用程序中,我想将 ArrayList
下面是 User bean 类。
class User {
String userId;
String userName;
String userCountry;
public String getuserId() {
return CountryId;
}
public void setuserId(String userId) {
userId = userId;
}
public String getuserName() {
return userName;
}
public void setuserName(String userName) {
userName = userName;
}
public String getuserCountry() {
return userCountry;
}
public void setuserCountry(String userCountry) {
userCountry = userCountry;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return userName;
}
}
【问题讨论】:
-
您需要创建Custom Adapter
-
你覆盖toString并返回用户名有什么问题。使用
ArrayAdapter并将其设置为 spinner,如果您不想只使用用户名,请使用自定义 adpater
标签: android spinner android-arrayadapter