RED_
RED_

Reputation: 3007

Android - Change position and size of gallery?

I have a gallery in my app, is there a way change the position of it?

I tried android:gravity="center" but that did nothing. Cant get the gallery to move.

Also can the gallery be made bigger? By an exact size too? I don't want it to be fullscreen but i do want it to be bigger than it normally is. Close to fullscreen. Nothing i've done has changed it.

Any ideas? Thanks in advance.

Upvotes: 2

Views: 3798

Answers (1)

satur9nine
satur9nine

Reputation: 15042

You can use layout_width and layout_height to set the size, the Gallery can be made to be pretty much any size you like. Usually you'll chose wrap_contents or fill_parent, but if you want to you can explicitly set the height to something such as 400dp and the width you would probably want to keep fill_parent. See declaring layout in Android docs for more info.

EDIT: Here is an example in XML:

<?xml version="1.0" encoding="utf-8"?>
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gallery"
    android:layout_width="fill_parent"
    android:layout_height="400dp"
    android:spacing="2px"
    />

Upvotes: 3

Related Questions