android-dialog

Fill control after click list

情到浓时终转凉″ 提交于 2019-12-11 17:39:37
问题 I have layout like <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:gravity="center_vertical|center_horizontal" android:orientation="horizontal" > <EditText android:id="@+id/et_OK" android:layout_width="400dip" android:layout_height="50dip" android:layout_toRightOf="@id/tv_patientNOK" android:background="@android:drawable/editbox_background" /> <Button

DialogFragment's width takes the whole screen unlike AlertDialog

风格不统一 提交于 2019-12-11 17:13:27
问题 I am trying to inflate a CustomView in my dialogFragment class, it works fine but the width takes the whole screen (90%) but if I inflate the same layout in AlertDialog, it just Works fine i.e width seems proper & good. I also tried setting the DialogFragment's width via onStart() but it wasn't the desired result... This is what I want (CustomView in AlertDialog) but here's the Result via DialogFragment - more width is taken as compared to AlertDialog! Layout File - <?xml version="1.0"

Finish an activity when user presses positive button on an associated dialogue

浪尽此生 提交于 2019-12-11 15:09:21
问题 I want my activity, which shows a dialogue, to finish when a user clicks on the positive button of the dialogue. Is this possible. where do I place finish()? Code that calls the dialogue: if(name.equals("")) { DialogFragment newFragment = new NouserFragment(); newFragment.show(getFragmentManager(), "makeprofile"); } code for dialogue: public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new

Changing default Android fade/scrim color when calling a Dialog

纵饮孤独 提交于 2019-12-11 13:36:59
问题 I've been working on an app and I've reaching the point where it requires me to display a menu window in the middle of the screen. I've been using an AlertDialog object filled with a custom View but now it was required of me to "surround" the window with a semi-transparent white glow as opposed to the default grayish one. I did a similar with the fade-in color of some navigation drawers I have on my app but in that case I had a specific method to quickly help me solve that problem. So far I

Get editText value from alertDialog builder

谁说我不能喝 提交于 2019-12-11 10:53:40
问题 I'm new to android . I need to get editText's value to search something. But when I run the program, error comes as null pointer exception . "EditText etSearch" isn't getting the text of it. Please help me. Thanks. public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id

Android dialog set cancel on touch out side

怎甘沉沦 提交于 2019-12-11 10:40:43
问题 I have this custom dialog inside an Activty which is inside ActivityGroup . I want the dialog to dismiss when clicked outside, and tried everything i found online to make it work.. I've tried the setCanceledOnTouchOutside(true) - didn't work I've tried: public boolean onTouchEvent ( MotionEvent event ) { // I only care if the event is an UP action if ( event.getAction () == MotionEvent.ACTION_UP ) { // create a rect for storing the window rect Rect r = new Rect ( 0, 0, 0, 0 ); // retrieve the

Android MaterialDialog Spinner

强颜欢笑 提交于 2019-12-11 10:36:21
问题 I'm using MaterialDialog.Builder to show a dialog. I set a customView for my dialog. In my layout i have a spinner and i want to populate it form my sqlite database when i show the dialog. The callback function only works when i push those buttons. Is there a function that i can use before dialog shows and use the layout that i set to append the spinner ? My code is like : boolean wrapInScrollView = true; new MaterialDialog.Builder(mContext) .customView(layout, wrapInScrollView) .autoDismiss

How to set image view in android dialog box?

左心房为你撑大大i 提交于 2019-12-11 10:17:23
问题 I am trying to set image view in android dialog box. If I select an image from gallery it shown in dialog with selected image. I will tried to get image from galley and passed to path to alert dialog. 回答1: AlertDialog.Builder ImageDialog = new AlertDialog.Builder(MainActivity.this); ImageDialog.setTitle("Title"); ImageView showImage = new ImageView(MainActivity.this); ImageDialog.setView(showImage); ImageDialog.setNegativeButton("ok", new DialogInterface.OnClickListener() { public void

No view found for id … for fragment in a Dialog

僤鯓⒐⒋嵵緔 提交于 2019-12-11 06:27:01
问题 I want show 2 tabs in a custom Dialog in an Activity , but I am getting the following error. Error: No view found for id 0x7f0f0134 (com.hiro.chatio:id/viewPage_theme) for fragment PostColorPickerFragment{35ffefce #0 id=0x7f0f0134 android:switcher:2131689780:0} java.lang.IllegalArgumentException: No view found for id 0x7f0f0134 (com.hiro.chatio:id/viewPage_theme) for fragment PostColorPickerFragment{35ffefce #0 id=0x7f0f0134 android:switcher:2131689780:0} MainActivity : private Button pick

push whole dialog above the keyboard, keyboard covers button

↘锁芯ラ 提交于 2019-12-11 04:25:43
问题 I have custom dialog which is attached to bottom of the screen. When I focus to the edittext, keyboard opens but it focuses to edittext so covers my button. I want to see the button. If I use same xml in activity it behaves correctly I tried all of the windowSoftInputMode's but didn't work, I also put my whole view in scrollview it also didn't work. My dialog XML , (I believe problem is here) <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk