DarkLeafyGreen
DarkLeafyGreen

Reputation: 70416

Adjust window size of android app on tablet

I am developing an android app for android smartphones but want to support tablets, too. I just tested my app on tablet emulator, it is scaled correctly and works fine.

A friend told me that it is possible to adjust the app window and place it somewhere on the screen so that the app does not fill up the whole screen.

Has anybody some information on that? I cannot find a ressource that describes that feature.

Upvotes: 1

Views: 2489

Answers (2)

ashish mittal
ashish mittal

Reputation: 1

You can access activity's window and change its attribute to get desired results. It will look like

    WindowManager.LayoutParams params=getWindow.getAttributes();
    params.width="any desied size";
    params.height="any desied size";
    getwindow.setAttributes(params);
    getWindow.setGravity(Gravity.Top);

Upvotes: 0

TryTryAgain
TryTryAgain

Reputation: 7820

Seems elementary, but aren't you then talking about a Widget: http://developer.android.com/guide/topics/appwidgets/index.html

And not a regular Application Activity?

The only other thing I could think of to suggest is to make a CustomView that is transparent around the area you want and have your Activity run in a defined region of that CustomView.

Maybe I misunderstood.

Upvotes: 1

Related Questions