I have an app in android which uses an autocomplete for a query in the DB….The autocomplete entries are displayed in a drop down list ….
The problem is that the size of the text displayed in this drop down list is very big and don’t know how to make it smaller:
This is a piece of code:
public View newView(Context context, Cursor cursor, ViewGroup parent){
Cursor c = getCursor();
final LinearLayout ret = new LinearLayout(context);
final LayoutInflater inflater = LayoutInflater.from(context);
mName = (TextView) inflater.inflate(
android.R.layout.simple_dropdown_item_1line, parent, false);
mNumber = (TextView) inflater.inflate(
android.R.layout.simple_dropdown_item_1line, parent, false);
ret.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout horizontal = new LinearLayout(context);
horizontal.setOrientation(LinearLayout.HORIZONTAL);
int nameCol = c.getColumnIndex(db.KEY_SURSA);
String name = c.getString(nameCol);
String number = c.getString(c.getColumnIndex(db.KEY_DATE));
mName.setText(name);
mNumber.setText(number);
horizontal.addView(mName, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
ret.addView(mNumber, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
ret.addView(horizontal, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
return ret;
}
mName and mNumber are the text view used for displaying my DB content….but how I obtain them frm inflating android.R.layout.simple_dropdown_item_1line I don’t know how could I modify the text size…
Maybe this is what you are looking for? This would set the text size to 100dip, you could adjust the number to whatever you are looking for.