vallllll
vallllll

Reputation: 2761

listview and screen orientation

I dont' event know if it's possible but here is what I would like to achieve. I have some actvities that show some data in listviews with list adapters (just compòsed of text views).

The layout is based on:

And Here is the basic composition of one "row" of the listView: textview1 textView2 textView4 textview5 inflatedview

(+++headers and footers)

So there is one column which looks fine when device is in portrait orientation but when in landscape there is a lot of space at the right of the screen plus you need tyo scroll a lot.

Well what I would like is that in landscape, two columns of the same list are shown. ( And later maybe for tablets 3 columns but that is for later....)

ok I know I could do:

textview textView

textView textView

but I don't want that

How could I implement that? I mean which tools to use?

thanks a lot in advance!

Upvotes: 1

Views: 882

Answers (1)

Pinki
Pinki

Reputation: 21929

For this we have one event is there when mobile orientation is changed i,e;

((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getOrientation()

By using above code we get the screen orientation .If orienation is landscape at that time you take 2 listviews side by side ,and set the values to that listviews

Upvotes: 1

Related Questions