Monday, October 10, 2011

[android-developers] How to remove the black space between the tittle bar and the first element of a LinearLayout?

share [fb] share [tw]


I have a linearlayout, wich 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 25px (more or
less) between the android tittle bar and the header of the app, wich
is the first element of the linearlayout

Whi i got that space? the only way i find to remove it is to put this
line: ll.setPadding(0, -25, 0, 0);

This is the full code:

public class MainGrid extends Activity {
private GridView myGridView;
private ImageAdapter myImageAdapter;
private ImageView header;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
ll.setGravity(Gravity.CENTER);
ll.setPadding(0, -25, 0, 0);
header = new ImageView(getApplicationContext());
header.setImageResource(R.drawable.header_acc);

myGridView = new GridView(this);
myImageAdapter=new ImageAdapter(this);
myGridView.setAdapter(myImageAdapter);

ll.addView(header);
ll.addView(myGridView);
setContentView(ll);
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate