-4
我是一名新的Android开发人员。如何在actionbar android中设置背景图片。如何在actionbar中设置背景图像android
我可以在我的操作栏中添加图像背景。但不能缩放我的图像。
我的风格
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
MainActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(mCustomView);
}
custom_actionbar布局
个<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/image" />
</RelativeLayout>
解决方案
我使用这个库>>Android-ObservableScrollView