Android 设置透明背景-操作栏
我试图将actionbar的背景设置为透明 可能吗?如果可能的话,有人能告诉我怎么做吗 这是我的密码:Android 设置透明背景-操作栏,android,android-actionbar,Android,Android Actionbar,我试图将actionbar的背景设置为透明 可能吗?如果可能的话,有人能告诉我怎么做吗 这是我的密码: public class MainMenu extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionbar = g
public class MainMenu extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionbar = getSupportActionBar();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main_menu);
LinearLayout v = (LinearLayout) findViewById(R.id.layout);
//v.setBackgroundColor(0xffECECEC);
v.setBackgroundResource(R.drawable.background);
actionbar.setDisplayShowTitleEnabled(false);
actionbar.setDisplayShowHomeEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.action, null);
TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.actiontitle);
mTitleTextView.setText("HADI");
actionbar.setCustomView(mCustomView);
actionbar.setDisplayShowCustomEnabled(true);
BitmapDrawable background = new BitmapDrawable (BitmapFactory.decodeResource(getResources(), R.drawable.actionbar));
background.setTileModeX(android.graphics.Shader.TileMode.REPEAT);
actionbar.setBackgroundDrawable(background);
}
通过在actionbar样式中设置alpha进行修复请参见