如何增加ListView的单元格大小

时间:2013-08-03 10:53:46

标签: android android-listview

我使用的是ListView,每个单元格的大小非常小。我想增加文字大小,以便细胞大小自动调整。但这没用。

我的java代码如下:

   View v= findViewById(R.id.rowtext);


    myPath = (TextView)findViewById(R.id.path);

    root = Environment.getExternalStorageDirectory().getPath();

    getDir(root);

}


public void bt_Quit(View v)
{
    finish();
}

public  void back(View v)
{
    getDir(pos);

}
public  void home(View v)
{
    getDir(root);

}

private void getDir(String dirPath)
{


    myPath.setText("Location: " + dirPath);
    item = new ArrayList<String>();
    path = new ArrayList<String>();
    File f = new File(dirPath);
    File[] files = f.listFiles();
    pos=f.getParent();
    if(!dirPath.equals(root))
    {

    }


    for(int i=0; i < files.length; i++)
    {
        File file = files[i];

        if(!file.isHidden() && file.canRead()){
            path.add(file.getPath());
            if(file.isDirectory()){
                item.add(file.getName() + "/");
            }else{
                item.add(file.getName());
            }
        }
    }

    ArrayAdapter<String> fileList =
            new ArrayAdapter<String>(this, R.layout.row, item);
    setListAdapter(fileList);
}

列表视图的单元格太小。我想知道如何调整listView的cellize?

1 个答案:

答案 0 :(得分:0)

更改列表视图的xml

     android:layout_width="20dp"
     android:layout_height="30dp"

根据您的需要更改数字