How to open an auxiliary window with three buttons on the selected list item, as shown in the screenshot with a red square

I need to open a sub window for a click list item. This window contains three buttons that are also available for viewing. See screenshot. enter image description here

On iphone, you can use TableRow. Is there a way in android like iphone or any other way.

+4
source share
5 answers

create a layout, including this extended view, which you want to display in the ListItem. Click

add the following code to your LISTViewclick listener where you really want to make it visible

Count is a variable that checks how many times it is pressed, even or odd, to make it visible and invisible, respectively.

IF((count%2)==0) { linearLayout.setvisibilty(View.GONE); } else { linearLayout.setvisibilty(View.VISIBLE); } 

LinearLayout here is your required layout in the screenshot ... (create this layout and set its parent visibilty layout to GONE )

set it to invisible at startup. and make it visible on itemclick accordingly

gives you a rough idea, you can customize the code accordingly

Hope this helps. I used the same tricks many times to make things happen

+1
source

I think you need to create your own style and apply this style to your dialog (/ sub-window, like calling it) and OnListItemClick, you should show this dialog box.

+1
source

If you want to do this, as in the screenshot above, you will need to make it part of your list item, define it above the normal contents of the list item and set the android:visibility="gone" value for this specific layout android:visibility="gone" . Then, when you click on the more button, set the layout visibility to android:visibility="visible" .

0
source

Just look @once here .. maybe this can help you.

enter image description here

You may be looking for an extensible element. can you look here ?

Also see here. How to implement extensible panels in Android?

0
source

First apply onItemClickListener to your list. Then in onItemClicked () call the new dialog box that I called.

View List:

 ListView listView = (ListView) findViewById(R.id.listview); listView.setOnItemClickListener(this); 

In onItemClick:

 public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { callDialog("Message"); } 

Your dialog coding:

 public static void callDialog(String message){ final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.customdialog); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.WHITE)); TextView tvTitle = (TextView) dialog.findViewById(R.id.textview_dialog_title); tvTitle.setText("MyDialog.."); TextView tvText = (TextView) dialog.findViewById(R.id.textview_dialog_text); tvText.setText(message); Button buttonDialogYes = (Button) dialog.findViewById(R.id.button_dialog_yes); buttonDialogYes.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Do some thing. dialog.dismiss(); } }); Button buttonDialogNo = (Button) dialog.findViewById(R.id.button_dialog_no); buttonDialogNo.setOnClickListener(new OnClickListener() { public void onClick(View v) { //Do some thing dialog.dismiss(); } }); dialog.show(); } 

Design your own xml file for the dialog box and set it to

 dialog.setContentView(R.layout.customdialog); 

And it will work fine as you need.

0
source

All Articles