如何查看适用于 Android 的任何控件的**实际**支持的样式属性的完整列表?



如何查看任何 Android 控件实际支持的样式属性的完整列表

例如,我正在尝试查看我可以在样式中为ActionMenuView控件设置哪些属性:

<android.support.v7.widget.ActionMenuView
android:id="@+id/toolbarLeft"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical|start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

例如,我无法确定它是否应该支持android:gravity属性。我认为应用它没有任何区别。

我想知道在哪里可以找到受支持属性的完整列表。Android文档似乎不包含该信息:https://developer.android.com/reference/android/support/v7/widget/ActionMenuView

对于重力,你不能。 由于重力不是视图的属性,而是它如何适应父视图的属性。 所以实际上这取决于父视图是否支持它。 layout_weight、layout_width、layout_height和边距等也是如此。

ActionMenuView只是扩展LinearLayoutCompat,它没有任何特殊属性。 您可以在下面看到原始来源。

/**
* ActionMenuView is a presentation of a series of menu options as a View. It provides
* several top level options as action buttons while spilling remaining options over as
* items in an overflow menu. This allows applications to present packs of actions inline with
* specific or repeating content.
*/
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker,
MenuView {
private static final String TAG = "ActionMenuView";
static final int MIN_CELL_SIZE = 56; // dips
static final int GENERATED_ITEM_PADDING = 4; // dips
private MenuBuilder mMenu;
/** Context against which to inflate popup menus. */
private Context mPopupContext;
/** Theme resource against which to inflate popup menus. */
private int mPopupTheme;
private boolean mReserveOverflow;
private ActionMenuPresenter mPresenter;
private MenuPresenter.Callback mActionMenuPresenterCallback;
MenuBuilder.Callback mMenuBuilderCallback;
private boolean mFormatItems;
private int mFormatItemsWidth;
private int mMinCellSize;
private int mGeneratedItemPadding;
OnMenuItemClickListener mOnMenuItemClickListener;
public ActionMenuView(Context context) {
this(context, null);
}
public ActionMenuView(Context context, AttributeSet attrs) {
super(context, attrs);
setBaselineAligned(false);
final float density = context.getResources().getDisplayMetrics().density;
mMinCellSize = (int) (MIN_CELL_SIZE * density);
mGeneratedItemPadding = (int) (GENERATED_ITEM_PADDING * density);
mPopupContext = context;
mPopupTheme = 0;
}

不支持的类版本在文档中提供了更多信息,包括支持的 XML 属性。例如:https://developer.android.com/reference/android/widget/ActionMenuView

但似乎,对于相应类的支持版本,属性无法正常工作。

最新更新