android - screen with top banner, webview and bottom banner -
i'm trying create simple android screen following content: top banner, webview , bottom banner. reason, can't it. xml like:
<?xml version="1.0" encoding="utf-8"?> <linearlayout android:id="@+id/framelayout02" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:fitssystemwindows="true" android:isscrollcontainer="false"> <imageview android:layout_width="wrap_content" android:layout_above="@+id/web" android:layout_height="fill_parent" android:layout_gravity="top" android:src="@drawable/logo"></imageview> <webview android:layout_gravity="center" android:id="@+id/web" android:layout_height="fill_parent" android:layout_width="fill_parent"></webview> <imageview android:layout_width="wrap_content" android:layout_below="@+id/web" android:layout_height="fill_parent" android:layout_gravity="bottom" android:src="@drawable/logo"></imageview> </linearlayout>
what wrong?
thanks, daniel
short answer wrong. code mess.
long answer. trying have imageview
above webview
, @ bottom imageview
. i'm not sure of mistakes broke that's not important. take @ example xml code.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:id="@+id/topimage" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:src="@drawable/icon"/> <imageview android:id="@+id/bottomimage" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:src="@drawable/icon"/> <webview android:id="@+id/web" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/topimage" android:layout_above="@id/bottomimage"/> </relativelayout>
now xml simple. uses relativelayout
container allow more flexible child alignment. imageview
called topimage
adjust height content , fill parent in width. aligned parents top. second imageview
similar exception pinned parents bottom. webview
aligned in between both imageview
s. adjust it's height 'imageview`s heights.
try keep kind of structure in xml , java code , others can throw @ without starting cry.
Comments
Post a Comment