android - ImageView hidden behind Button out of ideas -


i have imageview moving across screen once reaches button goes behind , imageview becomes hidden. on different layouts. have tried bringing both imageview , layout front, , making button both invisible , transparent (setalpha(0)). not sure code here ask , happily post whatever needed.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"  tools:context=".mainactivity"  android:id="@+id/relativelayout1"> <imageview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:id="@+id/friendly1"       /> <button      android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_below="@id/choice1"     android:layout_weight="5"     android:clickable="true"     android:id="@+id/btnrow1"     android:alpha="0"     android:visibility="invisible"     android:onclick="onclickrow1"/> </linearlayout> </relativelayout> 

then in init() method:

 friendly1 = (imageview) findviewbyid(r.id.friendly1);  friendly1.bringtofront();  relativelayout mainlayout = (relativelayout) findviewbyid(r.id.relativelayout1); mainlayout.bringtofront(); 

you can remove views parent, , re-add them @ specified indices. allow control views located in front of/behind others.

 viewgroup parent = (viewgroup)viewtoremove.getparent();             parent.removeview(viewtoremove);             parent.addview(viewtoremove, index); 

where 'index' int value of index want place view. views higher indices appear above lower ones.

extra tip: if want, can use same index of views want add, ones add first appear below ones add next (because viewgroup works arraylist).


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -