我正在使用List Activity从SQLITE中检索数据.但我无法设置列表视图的字体大小.请帮我.
public class CartList extends ListActivity { private ArrayListresults = new ArrayList (); public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(com.example.easyshopping.R.layout.cart); openAndQueryDatabase(); displayResultList(); } private void displayResultList() { setListAdapter(new ArrayAdapter (this, android.R.layout.simple_list_item_1, results)); getListView().setTextFilterEnabled(true); } private void openAndQueryDatabase() { try { SQLiteDatabase database = openOrCreateDatabase("ORCL", MODE_PRIVATE, null); Cursor c = database.rawQuery("SELECT title,qty,price FROM CART;", null); if (c != null ) { int totalPrice=0; if (c.moveToFirst()) { do { String title = c.getString(c.getColumnIndex("title")); int qty = c.getInt(c.getColumnIndex("qty")); int price = c.getInt(c.getColumnIndex("price")); int pricePerTitle=price*qty; results.add("Title: " + title + ", Quantity: " + qty+", Price: $"+pricePerTitle); totalPrice=totalPrice+pricePerTitle; }while (c.moveToNext()); } TextView tTotalPrice=(TextView)findViewById(com.example.easyshopping.R.id.txttotalprice); String total= Integer.toString(totalPrice); tTotalPrice.setText(total); } } catch (SQLiteException se ) { Log.e(getClass().getSimpleName(), "Could not create or Open the database"); } }
cart.xml
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_ android:layout_>
列表视图中的字体大小非常大.