开发者

Android: how can i position the listview at a particular location on the screen

开发者 https://www.devze.com 2023-01-12 09:14 出处:网络
I\'m trying to write an app for my Samsung Vibrant (running android 2.1). I used the example \"Form Stuff\" app available as tutorial on the android developers website. I basically added a background

I'm trying to write an app for my Samsung Vibrant (running android 2.1). I used the example "Form Stuff" app available as tutorial on the android developers website. I basically added a background picture to the application. the background picture has some text on it towards the top. I want to display a list of elements (to be selectable by teh user) but I want this list to start from a certain position on the screen (say for example - start from the middle of the screen). tried reading the listview under dev resource and searched the forums but I could not find a way to do this.

Could anyone please help me out? or if this is not开发者_高级运维 possible, then suggest me something else which i can place at a certain position on the screen.


You can use following logic,e.g

LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(100, 200);
lp.leftMargin=-100;

etc..... this workd for me


you can try using setSelection(position) property available on listview

0

精彩评论

暂无评论...
验证码 换一张
取 消