android - background of progressbar show -
i'm reading qr codes bluetooth device , every time find simulates "enter" whenever detect enter key runs show progressbar. put dark background transparent when dialog or released. have not found way progressbar.
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutlectorbluetooth" android:background="@android:color/transparent" android:layout_width="match_parent" android:layout_height="match_parent" > <edittext android:id="@+id/lectura" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_edittext" android:inputtype="textfilter|textmultiline" android:cursorvisible="false" android:singleline="true" android:lines="1" android:scrollhorizontally="true" android:layout_margintop="148dp" /> <imageview android:id="@+id/imageview2" android:layout_width="300dp" android:layout_height="300dp" android:layout_alignparentleft="true" android:src="@drawable/scan_trans" /> <textview android:id="@+id/textoejemplo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageview2" android:layout_centerhorizontal="true" android:layout_margintop="26dp" android:text="escanea el e-ticket para validarlo." android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/txtvalidando" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textoejemplo" android:layout_centerhorizontal="true" android:layout_margintop="30dp" android:text="" android:visibility="gone" android:textappearance="?android:attr/textappearancesmall" /> <progressbar android:id="@+id/loader_prueba" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textoejemplo" android:layout_centerhorizontal="true" android:visibility="gone" android:indeterminate="true" /> </relativelayout>
oncreate activity
lectura = (edittext)findviewbyid(r.id.lectura); lectura.setonkeylistener(new onkeylistener() { public boolean onkey(view view, int keycode, keyevent keyevent) { //this! findviewbyid(r.id.loader_prueba).setvisibility(view.visible);
example
edit
there 2 things wrong approach:
- the
@android:color/transparent
attribute totally transparent in no color @ all. you'll want opaque black color - if apply
android:background
progressbar
won't cover whole window, instead you'll have add newview
has both height , width setmatch_parent
edit: based on full layout posted now, add following (inside relativelayout
):
<relativelayout> <!-- that's 1 have --> <view android:id="@+id/background_dim" android:layout_height="match_parent" android:layout_width="match_parent" android:background="#42000000" android:visibility="gone" /> </relativelayout>
then need set view
visible when showing progressbar
:
findviewbyid(r.id.background_dim).setvisibility(view.visible);
Comments
Post a Comment