Make An Android Activity Full Screen Over A Button
Im new on android development and I want to know how can I make an android activity fullscreen via a Icon placed on toolbar. Thank You. Please click on link for example image: Clic
Solution 1:
I think this previous post may give you what you are looking for:
Fullscreen Activity in Android?
From post mentioned above:
You can do it programatically:
public class ActivityName extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove titlerequestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
Or you can do it via your AndroidManifest.xml file:
<activity android:name=".ActivityName"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
How your code should differ:
publicclassActivityNameextendsActivity {
@OverridepublicvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove titleButtonx= findViewById(R.id.yourButton);
x.setOnClickListener(newView.OnClickListener() {
@OverridepublicvoidonClick(View v) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
});
}
}
This would link your button with this code.
Post a Comment for "Make An Android Activity Full Screen Over A Button"