AS 找不到 BottomSheetBehavior_Params、_behavior_peekHeight 和 _behavior_hideable
AS can't find BottomSheetBehavior_Params, _behavior_peekHeight and _behavior_hideable
我刚刚将我的应用程序更新到支持库版本 24.0.0,我收到一些关于 BottomSheet 参数的错误。
代码:
/**
* Default constructor for inflating BottomSheetBehaviors from layout.
*
* @param context The {@link Context}.
* @param attrs The {@link AttributeSet}.
*/
public BottomSheetBehaviorGoogleMapsLike(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
android.support.design.R.styleable.BottomSheetBehavior_Params);
setPeekHeight(a.getDimensionPixelSize(
android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_peekHeight, 0));
setHideable(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_hideable, false));
a.recycle();
ViewConfiguration configuration = ViewConfiguration.get(context);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
Android Studio 找不到:
android.support.design.R.styleable.BottomSheetBehavior_Params
android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_peekHeight
android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_hideable
知道他们把它移到哪里了吗?
我明白了!他们改变了它的名字。只需将单词 Param
更改为 Layout
。
像这样:BottomSheetBehavior_Layout_behavior_peekHeight
更多信息in official docs
我刚刚将我的应用程序更新到支持库版本 24.0.0,我收到一些关于 BottomSheet 参数的错误。
代码:
/**
* Default constructor for inflating BottomSheetBehaviors from layout.
*
* @param context The {@link Context}.
* @param attrs The {@link AttributeSet}.
*/
public BottomSheetBehaviorGoogleMapsLike(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
android.support.design.R.styleable.BottomSheetBehavior_Params);
setPeekHeight(a.getDimensionPixelSize(
android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_peekHeight, 0));
setHideable(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_hideable, false));
a.recycle();
ViewConfiguration configuration = ViewConfiguration.get(context);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
Android Studio 找不到:
android.support.design.R.styleable.BottomSheetBehavior_Params
android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_peekHeight
android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_hideable
知道他们把它移到哪里了吗?
我明白了!他们改变了它的名字。只需将单词 Param
更改为 Layout
。
像这样:BottomSheetBehavior_Layout_behavior_peekHeight
更多信息in official docs