简要步骤是先初始化Arrayadapter,类型是string,然后装入listview中。发现每个item尺寸太大,在一个屏幕中放不开。故需要将尺寸(主要是高度)降低。谢谢

解决方案 »

  1.   

    定义每一个item的layout的高度。比如:在/layout文件中定义row.xml<?xml version="1.0" encoding="UTF-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent" 
    android:layout_height="10px"
    <TextView
            android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
    </RelativeLayout>在adapter的getView里面用inflator加载这个layout,就可以达到改变item高度的目的。
      

  2.   

    每个item是从res/values/strings.xml中得到的,不是从res/layout加载。我想,这个倒不重要。关键是getview中该怎么实现?谢谢
      

  3.   

            public View getView(int arg0, View arg1, ViewGroup arg2) {
                View view = null;
                
                LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
    view = inflater.inflate(R.layout.row, null);
    return view;
    ]从string中获得的只是数据内容,而不是layout。layout需要在/layout中去定义。
      

  4.   

    看样子LZ的LIST布局用的是系统的
    你改一下吧List的布局改成自己写,就容易控制了
    直接在配置文件里控制样式,灵活
      

  5.   


    listView = new ListView(this);
    /*
     * ADAPTER将ARRAYLISTMAP中的数据以COPY_MAIN的形式输出,TITLE_ONE数据对应LIST_TITLE,
     * BODY_ONE数据对应到LIST_BODY
     */
    SimpleAdapter adapter = new SimpleAdapter(this,
    MySQLite_3.arraylistmap, R.layout.copy_main, new String[] {
    MySQLite_3.TITLE_ONE, MySQLite_3.BODY_ONE }, new int[] {
    R.id.list_title, R.id.list_body });listView.setAdapter(adapter);你要修改的东西就是你自己的copy_main这个LAYOUT,你可以根据你自己的需求,修改每一个内部控件的大小以及位置的关系等。
      

  6.   

    定义一个text_contnet.xml文件,里面只放一个textview, ID为list_title在这个布局里面设置字体的大小,
    在主activity里面
    ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>();
    HashMap<String, string> map;
    for (int i = 0; i < 你要显示的字条串数组的长度;i++)
    {
        map =  = new HashMap<String, string>();
        map.put("content",字符串数组名[i]);
        list.add(map);}
    SimpleAdapter adapter = new SimpleAdapter(this,
                    list, R.layout.text_contnet, new String[] {
                            "content"}, new int[] {
                            R.id.list_title});listView.setAdapter(adapter);这样子就OK了
      

  7.   

    简单,这个你在inflate的layout文件中中设置高度和宽度就OK了!
      

  8.   

    行高,是你在adapter中添加布局。在设置布局的高度,还有如果布局是全屏。只要设置布局中的组件layout_height 即可。试试吧