Help with Android XML layout
I am trying to get my xml to lay this out properly. How it is now, the video is mooshed. If I take away the
android:layout_below="@id/day_scroller"
in the VideoView tag and add
android:layout_centerHorizontal="true"
the video size is now proportioned, but I lose my content that is display in my
android:id="@+id/day_container"
I did not create this layout, but am trying to understand how layouts work and to get this one to work properly. Any help or leads to where I can gain a better understanding is greatly appreciated!
Here is what I want:
And here is the XML:
<?xml version="1.0" encoding="utf-8"?>
>
<com.accuweather.wordweather.SnapHorizontalScrollView android:id="@+id/day_scroller"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:scrollbars="none"
android:fadingEdge="none"
>
<LinearLayout android:id="@+id/day_container"
android:orientation="horizontal"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:paddingTop="45dip"
/>
</com.accuweather.wordweather.SnapHorizontalScrollView>
<TextView
android:id="@+id/location"
android:layout_width="fill_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:background="@drawable/background"
android:textSize="20dip"
/>
<ImageView android:id="@+id/current_alert_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/alert_icon"
android:visibility="gone"
/>
<VideoView android:id="@+id/videoview"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_centerHorizontal="true"
/>
<ProgressBar android:id="@+android:id/progress_large"
style="?android:attr/progressBarStyleLarge开发者_开发知识库"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_marginBottom="4dip"
>
<ImageView android:id="@+id/scroll_page_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/scrollview_page_on"
/>
<ImageView android:id="@+id/scroll_page_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/scrollview_page_off"
/>
<ImageView android:id="@+id/scroll_page_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/scrollview_page_off"
/>
</LinearLayout>
<ImageView
android:id="@+id/logo"
android:scaleType="fitXY"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dip"
android:src="@drawable/logo"
android:layout_marginBottom="10dip"
android:layout_width="150dip"
android:layout_height="13dip"
/>
<Button
android:id="@+id/logo_mask"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="5dip"
android:layout_marginBottom="5dip"
android:layout_width="180dip"
android:layout_height="50dip"
android:background="@drawable/trans"
/>
You could use a LinearLayout with android:orientation="vertical" and store everything in it : all of the LinearLayout's children will be arranged vertically.
精彩评论