0

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);
            }

        });
JAnoob92
  • 15
  • 5
  • possible duplicate of [Android ListView Text Color](http://stackoverflow.com/questions/4533440/android-listview-text-color) –  Oct 11 '14 at 00:30

1 Answers1

0

Try setting as parent a RelativeLayout (with height and width fill_parent), instead of a LinearLayout. After that, set these properties to your ListView:

android:align_ParentBottom="true"
android:align_ParentRight="true"

I hope it helps!!

Juan Aguilar Guisado
  • 1,687
  • 1
  • 12
  • 21