title: ListPopupWindow not obeying WRAP_CONTENT width spec
body: <p>I'm trying to use ListPopupWindow to show a list of strings via an <code>ArrayAdapter</code> (eventually this will be a more complex custom adapter). Code is below. As shown in the screenshot, the resulting <code>ListPopupWindow</code> seems to act as if the content width is zero. It shows the proper number of items, the items are still clickable, and clicking successfully produce a <code>Toast</code>, so at least that much is working properly. </p>
  
  <p>An interesting note: I could supply a width in pixels to <code>popup.setWidth(...)</code> instead of <code>ListPopupWindow.WRAP_CONTENT</code> and it will show some of the content, but this seems very inflexible.</p>
  
  <p>How do I make the <code>ListPopupWindow</code> wrap its content?</p>
  
  <p><strong>Test activity:</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
  
      private static final String[] STRINGS = {"Option1","Option2","Option3","Option4"};
      private View anchorView;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getActionBar().setHomeButtonEnabled(true);
          setContentView(R.layout.activity_main);
          anchorView = findViewById(android.R.id.home);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
              case android.R.id.home:
                  showPopup();
                  return true;
          }
          return super.onOptionsItemSelected(item);
      }
  
      private void showPopup() {
          ListPopupWindow popup = new ListPopupWindow(this);
          popup.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, STRINGS));
          popup.setAnchorView(anchorView);
          popup.setWidth(ListPopupWindow.WRAP_CONTENT);
          popup.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  Toast.makeText(MainActivity.this, "Clicked item " + position, Toast.LENGTH_SHORT).show();
              }
          });
          popup.show();
      }
  }
  </code></pre>
  
  <p><strong>screenshot:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/VEQrn.png" alt="enter image description here"></p>