0
我需要在ListView中更改我的項目的大小和顏色。 它在LinearLayout中只有一個ListView,當我打開ListView打開佈局頂部時,我想讓他顯示在右下角。謝謝你的建議。Android ListView字體
公共無效的onClick(視圖v){
DisplayMetrics metrics = new DisplayMetrics();
((Activity) mContext).getWindowManager().getDefaultDisplay().getMetrics(metrics);
int h = metrics.heightPixels;
int w = metrics.widthPixels;
int[] loc_int = new int[2];
v.getLocationOnScreen(loc_int);
Rect location = new Rect();
location.left = loc_int[0];
location.top = loc_int[1];
location.right = location.left + v.getWidth();
location.bottom = location.top + v.getHeight();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.popup_libro_lista,(ViewGroup) grid.findViewById(R.id.popup_element));
ListView listView = (ListView) layout.findViewById(R.id.listPopUp);
final ArrayAdapter<String> adaptador = new ArrayAdapter<String>(mContext, `android.R.layout.simple_spinner_item`, listaLibrosToAccess.get(newpos).menuPopUp);
listView.setAdapter(adaptador);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id){
Log.d("Este adapter conduce a: ", adaptador.getItem(position).toString());
}
});
pwindo2 = new PopupWindow(layout, h, w, true);
pwindo2.showAtLocation(layout, Gravity.CENTER, 0, 0);
}
});
[Android ListView Text Color]的可能重複(http://stackoverflow.com/questions/4533440/android-listview-text-color) – apoorvk 2014-10-11 00:30:03