android xml Layout issue -
i spent hours on this, layout issue. can tell me how show both image , view switcher in same activity.
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res/rg.client.muscle" android:layout_width="fill_parent" android:layout_height="fil_parent"> <viewswitcher android:id="@+id/relative" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true"> <!-- contains 2 relative layouts of same sizes containing same elements switched positions --> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" > <com.admob.android.ads.adview android:id="@+id/adv" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" myapp:backgroundcolor="#000000" myapp:primarytextcolor="#ffffff" myapp:secondarytextcolor="#cccccc" myapp:refreshinterval="30" > </com.admob.android.ads.adview> <linearlayout android:id="@+id/linear" android:orientation="horizontal" android:weightsum="100" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@id/adv" > <button android:id="@+id/but_prev2" android:text="previous" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="30" > </button> <button android:id="@+id/but_more2" android:text="more" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="40" > </button> <button android:id="@+id/but_next2" android:text="next" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="30"> </button> </linearlayout> </relativelayout> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" > <linearlayout android:id="@+id/linear2" android:orientation="horizontal" android:weightsum="100" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" > <button android:id="@+id/but_prev" android:text="previous" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="30"> </button> <button android:id="@+id/but_more" android:text="more" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="40"> </button> <button android:id="@+id/but_next" android:text="next" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="30"> </button> </linearlayout> <com.admob.android.ads.adview android:id="@+id/adv2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@id/linear2" myapp:backgroundcolor="#000000" myapp:primarytextcolor="#ffffff" myapp:secondarytextcolor="#cccccc" myapp:refreshinterval="30"> </com.admob.android.ads.adview> </relativelayout> </viewswitcher> <imageview android:id="@+id/image" android:layout_above="@id/relative" android:padding="2pt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" > </imageview> </relativelayout>
if put imageview first each time new image loaded buttons disappear , whole layout seems re inflated
update:
the layout must have image view @ top view switcher.
i imagine lot of has not being able read xml. if looks way pasted in here, is. first problem have nothing in root relativelayout tag specifying size. root layout should in cases set layout_width
of fill_parent
, same layout_height
. need schema specification (i.e. xmlns:android="http://schemas.android.com/apk/res/android"
although i'm assuming left out, since you're getting compile.
you may want keep in mind, since set wrap_content
height, if ever exceeds height of screen, of not visible, may consider wrapping inner portion scrollview
.
edit: again, i'd suggest setting relativelayout (root element) have height of fill_parent
. try defining imageview first, leaving alignparenttop="true"
, define viewswitcher, , give layout_below="@id/image"
attribute.
Comments
Post a Comment