Friday, April 12, 2013

[android help] Transparent action bar in actionbarshearlock activity


enter image description here



without use actionbarshearlock:



just add this line: requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);


before setContentView(R.Layout.Test) in onCreate


and this line give you TRANSPARENT ActionBar



getActionBar().setBackgroundDrawable(
getResources().getDrawable(R.drawable.ab_bg_black));


like:



@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.activity_main);

getActionBar().setBackgroundDrawable(
getResources().getDrawable(R.drawable.ab_bg_black));
}


for R.drawable.ab_bg_black just add drawable colour in string.xml like:



#80000000



same way using actionbarshearlock:




@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(SampleList.THEME); //Used for theme switching in samples
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
super.onCreate(savedInstanceState);
setContentView(R.layout.overlay);

//Load partially transparent black background
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_black));

}



Edited: *Start listview After Actionbar.*


enter image description here


if you are using actionbarshearlock then just do like below:



android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="?actionBarSize" >





.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...