How To Remove The Black Space Between The Title Bar And The First Element Of A Linearlayout?
I have a linearlayout, which the first element is a imageview header, and the second element is a gridview. It works fine, but I have a erroneal black space of 50px (more or less)
Solution 1:
Update: This should work just fine if you set android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
in the Manifest.
publicclassMainGridextendsActivity {
private GridView myGridView;
private ImageAdapter myImageAdapter;
private ImageView header;
publicvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayoutll=newLinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
ll.setGravity(Gravity.TOP); // SET THIS TO TOP
LinearLayout.LayoutParamslp=newLinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
ll.setLayoutParams(lp);
// I'VE ADDED LAYOUTPARAMS TOO
header = newImageView(getApplicationContext());
header.setImageResource(R.drawable.header_acc);
myGridView = newGridView(this);
myImageAdapter=newImageAdapter(this);
myGridView.setAdapter(myImageAdapter);
ll.addView(header);
ll.addView(myGridView);
setContentView(ll);
}
Solution 2:
If you're not using the title bar, you can always get rid of it:
http://elliotth.blogspot.com/2009/07/removing-title-bar-from-your-android.html
Solution 3:
Using this in for activity tag in manifest solves your problem
android:theme="@android:style/Theme.NoTitleBar"
For Full screen you should use
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Post a Comment for "How To Remove The Black Space Between The Title Bar And The First Element Of A Linearlayout?"