I'm trying to place a seekbar under an image that I had loaded into an imageview - the xml (below) works fine but
what I would like to do is set the maximum length of the seekbar equal to the width of the image when it is loaded
and also center it under the image. I've done some research on this group, and the following code resizes the bar:

```
   LayoutParams lp = new LayoutParams(img2.getWidth(), 50);
   simpleSeekBar.setLayoutParams( lp );

```

However, it puts the seekbar against the left margin; how do I change this to center it?
And how do I get it work when the user alternates between landscape and portrait? When switching between the two orientations, the image gets centered - how do I get the seekbar to dynamically center too?

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/frlayout"
    android:layout_weight="0.80"
    android:layout_width="match_parent"
        android:layout_height="0dp">
            <ImageView
            android:id="@+id/ImageTest"
                android:background="@android:color/transparent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true" />
    </FrameLayout>
<SeekBar
    android:id="@+id/seekBar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:progress="1000"
    android:max="2000"
    />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".20"
android:background="#004D79"
android:orientation="horizontal">
    <Button
        android:text="Open File"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:id="@+id/ofbutton" />
    <Button
        android:text="Save File"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:id="@+id/sfbutton" />
    <NumberPicker
        android:id="@+id/np"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:background="@drawable/drawablenp"
        android:layout_centerVertical="true"
        />
</LinearLayout>

```