Reputation: 129
I am trying to do some function in Android 2.2. How can I remove and the borders in white and gray that is shown in below picture?
Upvotes: 0
Views: 79
Reputation: 2062
You can do it by two ways
1) Programatically :
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class ActivityName extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
2) Modifying AndroidManifest.xml
file:
<activity android:name=".ActivityName"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity>
Upvotes: 0
Reputation: 5260
you just need to have an edit in manifest as follows
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
this line will not show tiltlebar and will be a fullscreen however if you wants to hide just the title bar than use
android:theme="@android:style/Theme.NoTitleBar"
by means yours manifest should look like this
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.android.some"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="9" />
</manifest>
you can acieve the same by programming as follows
requestWindowFeature(Window.FEATURE_NO_TITLE);
Upvotes: 0
Reputation: 5234
Add this line to your manifest file where you have declared your activity.
<activity
android:name=".activityName"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
or progrmatically you can do it by adding
requestWindowFeature(Window.FEATURE_NO_TITLE);
this above line with onCreate
method
Upvotes: 1
Reputation: 691
set Activity's theme to @android:style/Theme.NoTitleBar
, in manifest
Upvotes: 1
Reputation: 2342
In your oncreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); // put that line in your oncreate method
setContentView(R.layout.youlayout);
}
Upvotes: 0