How to resize activity listview in android? -


hi want resize listview in android.

i have other source previous topics.

.xml

<linearlayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical"     android:padding="3dp" >      <textview         android:id="@+id/currentdirectorytextview"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="current directory:" />      <listview         android:id="@android:id/list"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_margintop="5dp"         android:textsize="30sp"         android:layout_weight="1" />  </linearlayout> 

.class

    arrayadapter adapter = new arrayadapter(this,             android.r.layout.activity_list_item, android.r.id.text1, values);     setlistadapter(adapter); 

how resize list? small. same after changing textsize.

this whole class listfileactivity.

public class listfileactivity extends listactivity {  private string path;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      // use current directory     path = android.os.environment.getexternalstoragedirectory()             + file.separator + appconstant.directory;     if (getintent().hasextra("path")) {         path = getintent().getstringextra("path");     }     updatecurrentdirectorytextview();      // read files sorted values-array     list values = new arraylist();     file dir = new file(path);     if (!dir.canread()) {         settitle(gettitle() + " (inaccessible)");     }     string[] list = dir.list();     if (list != null) {         (string file : list) {             if (!file.startswith(".")) {                 values.add(file);             }         }     }     collections.sort(values);      // put data list   /*   listview lst = new listview(this);     //string[] arr = {"item 1","item 2"};     arrayadapter<string> ad = new arrayadapter<string>(this,r.layout.mylist,values);     lst.setadapter(ad);*/      arrayadapter adapter = new arrayadapter(this,             android.r.layout.activity_list_item, android.r.id.text1, values);     setlistadapter(adapter);  }  private void updatecurrentdirectorytextview() {     ((textview) this.findviewbyid(r.id.currentdirectorytextview))             .settext("current directory: " + path); } 

}

remove weight, i.e. remove line

android:layout_weight="1" 

also trying setting text size listview? should adapter or individual item layouts


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -