display the back and next button between half the height of image android
i have a problem in xml layout for displayi开发者_开发百科ng next and back button besides the image and should be in middle of height of image.
pls see this url
http://screencast.com/t/zE47nb0rkFE
two buttons are above the image,it is left and right but not the middle height of image. and it should be for every resolution size of screen.
my xml is
<?xml version="1.0" encoding="utf-8"?>
you can use scrollview in code like this ::
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:id="@+id/imv"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="55dip"
/>
<ImageView
android:id="@+id/imagegallery"
android:layout_width="70sp"
android:layout_height="70sp"
android:layout_alignParentRight="true"
android:layout_below="@id/imv"/>
<ProgressBar
android:id="@+id/Bar"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:layout_above="@id/imagegallery"
android:layout_below="@id/imv"
/>
<TextView android:layout_height="wrap_content"
android:id="@+id/textView1"
android:text="Art Gallery"
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_below="@id/imv"
/>
<TextView android:layout_height="wrap_content"
android:id="@+id/textView2"
android:textColor="#00C000"
android:textSize="20dip"
android:text=" "
android:layout_width="wrap_content"
android:layout_toLeftOf="@id/imagegallery"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView1"
/>
<TextView android:layout_height="wrap_content"
android:id="@+id/textopeningnow"
android:text="Opening Now"
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_below="@id/textView2"
/>
<TextView android:layout_height="wrap_content"
android:id="@+id/diosas"
android:textSize="20dip"
android:text="Diosas/Godesses"
android:textColor="#00C000"
android:layout_width="wrap_content"
android:layout_below="@id/textopeningnow"
/>
<Button
android:id="@+id/back"
android:layout_height="wrap_content"
android:layout_width="25dip"
android:layout_centerVertical="true"
android:background="@drawable/leftarrow"/>
<Button
android:id="@+id/next"
android:layout_height="wrap_content"
android:layout_width="25dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/rightarrow"/>
<ImageView android:id="@+id/imageLoader"
android:layout_width="wrap_content"
android:layout_height="200dip"
android:layout_toLeftOf="@id/next"
android:layout_toRightOf="@id/back"
android:layout_below="@id/diosas"
/>
<TextView
android:id="@+id/artistname"
android:textColor="#000000"
android:text=" "
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@id/imageLoader"
android:layout_centerInParent="true"
/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I'd enclose your image in a separate RelativeLayout, and add the buttons to it. It's way too hard to try to achieve what you want with just a global relative layout.
精彩评论