Add @TestApi PopupMenu.getMenuListView
This method returns the ListView representing the menu.
It is required to test the actual contents of a PopupMenu.
Bug: 34076597
Test: android.widget.cts.ToolbarTest#testItemViewAttributes,
android.widget.cts.PopupMenuTest#testItemViewAttributes
Change-Id: Id72a8f482048d724d4fde15b126e0d08e1d18390
This commit is contained in:
@@ -48793,6 +48793,7 @@ package android.widget {
|
||||
method public int getGravity();
|
||||
method public android.view.Menu getMenu();
|
||||
method public android.view.MenuInflater getMenuInflater();
|
||||
method public android.widget.ListView getMenuListView();
|
||||
method public void inflate(int);
|
||||
method public void setGravity(int);
|
||||
method public void setOnDismissListener(android.widget.PopupMenu.OnDismissListener);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.widget;
|
||||
|
||||
import android.annotation.MenuRes;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
@@ -281,4 +282,19 @@ public class PopupMenu {
|
||||
*/
|
||||
void onDismiss(PopupMenu menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link ListView} representing the list of menu items in the currently showing
|
||||
* menu.
|
||||
*
|
||||
* @return The view representing the list of menu items.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public ListView getMenuListView() {
|
||||
if (!mPopup.isShowing()) {
|
||||
return null;
|
||||
}
|
||||
return mPopup.getPopup().getListView();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user