Моя активность раздувает пользовательскую панель действий, чтобы получить переход градиента от непрозрачного черного к прозрачному при движении вверх.Пользовательская панель действий, не показывающая
EDIT: - Я изменил код, и теперь я получаю этот выход: -
Мой код: -
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//action bar setting
//Getting Action Bar
ActionBar mActionBar= getActionBar();
LayoutInflater minflate =(LayoutInflater) mActionBar.getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View mview = minflate.inflate(R.layout.subgrid_ab,null);
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,ActionBar.DISPLAY_SHOW_CUSTOM|ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_SHOW_TITLE);
mActionBar.setCustomView(mview, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
TextView mtext =(TextView)mview.findViewById(R.id.subgridab_text);
mtext.setText("General");
setContentView(R.layout.gridsub);
}
Это означает вид накачивают, но градиент эффект пока не отображается.
subgrid_ab.xml: -
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_ab"
>
<TextView
android:id="@+id/subgridab_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:layout_gravity="center"
android:text="dd"
android:textSize="24sp"
android:layout_centerInParent="true"/>
</RelativeLayout>
custom_ab.xml: -
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:startColor="#FF000000"
android:endColor="#00000000"
android:angle="270"
/>
</shape>
Так что я делаю неправильно?
Все еще получая такой же выход, без изменений! – Mohit