I need to change the size and the color of my items in the ListView. Its only a ListView inside a LinearLayout, and when i open the ListView opens in the top of the Layout i want he shows in the bottom right. Thanks in advice.
public void onClick(View 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);
}
});