为什么CSDN的正文有时显示.有时又是显示摘要呢

这是正文
阅读更多

androidlistView里面的数据为什么有时显示有时显示

04-05

activityrnrnpackage com.mingyang.zhongtoulvyou;rnrnimport java.util.ArrayList;rnimport java.util.HashMap;rnimport java.util.List;rnimport java.util.Map;rnrnimport org.json.JSONArray;rnimport org.json.JSONException;rnimport org.json.JSONObject;rnrnimport com.android.volley.RequestQueue;rnimport com.android.volley.Response;rnimport com.android.volley.VolleyError;rnimport com.android.volley.toolbox.StringRequest;rnimport com.android.volley.toolbox.Volley;rnimport com.mingyang.zhongtoulvyou.adapter.homepage_remenAdapter;rnimport com.mingyang.zhongtoulvyou.adapter.homepage_shouyeAdapter;rnimport com.mingyang.zhongtoulvyou.view.DynamicGridView;rnrnimport android.app.Activity;rnimport android.content.Intent;rnimport android.os.Bundle;rnimport android.util.Log;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.view.Window;rnimport android.widget.AdapterView;rnimport android.widget.GridView;rnimport android.widget.LinearLayout;rnimport android.widget.AdapterView.OnItemClickListener;rnrn/*rn * 精选套餐rn */rnpublic class PackageActivity extends Activity implements OnClickListener rnrn private LinearLayout packge_fanhui;rn private GridView package_remen;rn private List> data = new ArrayList>();rn private homepage_remenAdapter adapter;rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn requestWindowFeature(Window.FEATURE_NO_TITLE);rn setContentView(R.layout.package_);rn isopen_remen();rn // 返回键rn packge_fanhui = (LinearLayout) findViewById(R.id.packge_fanhui);rn packge_fanhui.setOnClickListener(this);rn //推荐rn package_remen = (GridView) findViewById(R.id.package_remen);rn adapter = new homepage_remenAdapter(this, data);rn package_remen.setAdapter(adapter);rn package_remen.setOnItemClickListener(new OnItemClickListener() rnrn @Overridern public void onItemClick(AdapterView adapter, View v,rn int position, long arg3) rnrn rn );rn rnrn @Overridern public void onClick(View v) rn switch (v.getId()) rn // 返回键rn case R.id.packge_fanhui:rn finish();rn startActivity(new Intent(PackageActivity.this,rn DetailsActivity.class));rn break;rn default:rn break;rn rn rn rn private void isopen_remen() rn RequestQueue mQueue = Volley.newRequestQueue(this);rn StringRequest stringRequest = new StringRequest(rn "http://test.imingyang.com/haowan/data/api.php?act=popularRecommendation",rn new Response.Listener() rn public void onResponse(String response) rn try rn JSONObject object = new JSONObject(response);rn JSONArray jsonArray = object.getJSONArray("data");rn Log.e("jsonArray", jsonArray.toString());rn for (int i = 0; i <= jsonArray.length(); i++) rn JSONObject jsonObject = jsonArrayrn .getJSONObject(i);rn int id = jsonObject.getInt("id");rn String user_idx = Integer.toString(id);rn String name = jsonObject.getString("name");rn String price = jsonObject.getString("price");rn String urlString = jsonObjectrn .getString("picture");rn Map map = new HashMap();rn // 一条新闻的字典rn map.put("id", user_idx);rn map.put("name", name);rn map.put("price", price + "元起");rn map.put("picture", urlString);rn data.add(map);// 放入列表rn rn adapter.notifyDataSetChanged();rn catch (JSONException e) rn e.printStackTrace();rn rn rn , new Response.ErrorListener() rn public void onErrorResponse(VolleyError error) rn Log.e("TAG", error.getMessage(), error);rn rn );rn mQueue.add(stringRequest);rn rnrn******************************************************************rnadapterrnrnpackage com.mingyang.zhongtoulvyou.adapter;rnrnimport java.util.List;rnimport java.util.Map;rnrnimport com.mingyang.zhongtoulvyou.R;rnimport com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache;rnimport com.nostra13.universalimageloader.core.DisplayImageOptions;rnimport com.nostra13.universalimageloader.core.ImageLoader;rnimport com.nostra13.universalimageloader.core.ImageLoaderConfiguration;rnimport com.nostra13.universalimageloader.core.assist.ImageScaleType;rnrnimport android.content.Context;rnimport android.graphics.Bitmap;rnimport android.view.LayoutInflater;rnimport android.view.View;rnimport android.view.ViewGroup;rnimport android.widget.BaseAdapter;rnimport android.widget.ImageView;rnimport android.widget.TextView;rnrnpublic class homepage_remenAdapter extends BaseAdapter rn private Context context;rn private List> data;rn private ImageLoader imageLoader;rnrn public homepage_remenAdapter(Context context, List> data) rn this.context = context;rn this.data = data;rn initImageLoader();rn rnrn private void initImageLoader() rn DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()rn .cacheOnDisc().imageScaleType(ImageScaleType.EXACTLY_STRETCHED)rn .bitmapConfig(Bitmap.Config.RGB_565).build();rn ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(rn context).defaultDisplayImageOptions(defaultOptions)rn .memoryCache(new WeakMemoryCache());rnrn ImageLoaderConfiguration config = builder.build();rn imageLoader = ImageLoader.getInstance();rn imageLoader.init(config);rn rnrn @Overridern public int getCount() rn return data.size();rn rnrn @Overridern public Object getItem(int position) rn return data.get(position);rn rnrn @Overridern public long getItemId(int position) rn return position;rn rnrn @Overridern public View getView(int position, View convertView, ViewGroup parent) rn ViewHolder viewHolder;rn if (convertView == null) rn convertView = LayoutInflater.from(context).inflate(rn R.layout.homepage_remen, null);rn viewHolder = new ViewHolder();rnrn viewHolder.remen_image = (ImageView) convertViewrn .findViewById(R.id.remen_image);rn rn viewHolder.mingcheng_text = (TextView) convertViewrn .findViewById(R.id.mingcheng_text);rn rn viewHolder.jiage_text = (TextView) convertViewrn .findViewById(R.id.jiage_text);rn convertView.setTag(viewHolder);rn else rn viewHolder = (ViewHolder) convertView.getTag();rn rn rn imageLoader.displayImage(rn data.get(position).get("picture").toString(),rn viewHolder.remen_image);rn rn viewHolder.mingcheng_text.setText((String) data.get(position).get(rn "name"));rn rn viewHolder.jiage_text.setText((String) data.get(position).get(rn "price"));rn return convertView;rn rnrn class ViewHolder rn // 图片rn private ImageView remen_image;rn private TextView mingcheng_text;rn private TextView jiage_text;rn rnrnrnrn*上面是activity,下面是adapter

combo有时不能显示

12-03

网上看到这篇文章:rn1)为什么在combobox中是空白,一定要用鼠标下拉点击后才能显示某个数据?rn 为什么在listbox初始的时候,焦点移动到list却没有任何item被选中?rn答:这两个问题其实是同一个问题,请关注controlsource这个属性,就能解决了。 controlsource决定了它绑定的数据的变量或属性,[color=#FF0000]通常请将controlsource='this.comment'[/color]。rn 首先你一定已经定义了rowsource和rowsourcetype.rn 假设数据源是个表(employee), 数据源列为name。rn 那么请在comment属性中填写:=employee.namern 假设数据源是个数组(employee()), 而你要在初始的时候显示(或选中)employee(1)中的值。rn 那么请在comment属性中填写:=employee(1)rn 这样定义后,你可以发现,不用用鼠标选择,combobox/listbox就会有一个值被选中了。而且你也不用新建属性来定义当前值了。在接下来的时候.value永远等于.comment中的值。另外你不用去管displayvalue这个属性。rn 使用controlsource来定向控制源还有一个好处,假如你要在这张表中查询一条记录(如name='John'),通常的做法是:rn select employeern locate all for name='John'rn thisform.list1.refreshrn 其实不必,只要:rn thisform.list1.comment='John'rn thisform.list1.refreshrn 就可以了。rn combo/list的value只受controlsource定向的变量/属性所控制rnrn文中红色部分在哪设置?rnrn

没有更多推荐了,返回首页