我正在尝试将操作栏的背景设置为透明
有可能吗?如果有可能,有人可以告诉我如何?
以下是我的代码:
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);
}
答案 0 :(得分:0)