I'm trying to set the background of the actionbar to be transparent
Is it possible? if possible can someone show me how?
Here are my codes:
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);
}
通过在操作栏样式中设置Alpha进行修复
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.