我的代碼如下,當放在類延伸Activity class但addRule給編譯錯誤說,它是不確定的,當我延長ActionBarActivity。ActionBar.LayoutParams中的'addRule(int)'的替代方法,就像RelativeLayout.LayoutParams中的addRule一樣?
Error:
The method addRule(int) is undefined for the type ActionBar.LayoutParams
問題:什麼是替代在ActionBar.LayoutParamsaddRule(int) in RelativeLayout.LayoutParams?
private void initializeSlidingLayer() {
LayoutParams myrlp = (LayoutParams) mySlidingLayer.getLayoutParams();
getResources().getDrawable(R.drawable.ic_launcher);
//for bottom
mySlidingLayer.setStickTo(SlidingLayer.STICK_TO_BOTTOM);
myrlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); //THIS LINE THROWS ERROR WITH ACTIONBARACTIVITY
myrlp.width = LayoutParams.MATCH_PARENT;
myrlp.height = getResources().getDimensionPixelSize(R.dimen.layer_width);
//Adding Shadow
mySlidingLayer.setShadowWidthRes(R.dimen.shadow_width);
mySlidingLayer.setShadowDrawable(R.drawable.sidebar_shadow);
//mSlidingLayer.setOffsetWidth(0);
mySlidingLayer.setOffsetWidth(getResources().getDimensionPixelOffset(R.dimen.offset_width));
}
也許不相關的問題,但我想this SlidingLayer Library