I have Listview which contain multiples items. I like to click on 1st item of listview by using android test cases.
How can achieve this?
Please help me.
Listview hierarchy :-
MainActivity -> ListFragment -> Listview
Try this:
onData(hasToString(startsWith("item_name")))
.inAdapterView(withId(R.id.view_id)).atPosition(0)
.perform(click());
or
onData(hasToString(startsWith("item_name")))
.inAdapterView(withId(R.id.view_id))
.perform(click());
You can mention the position of the adapter view or no need, default it will take first position
Related
There is a particular functionality from Android that I would like to implement in a Xamarin.Forms/Xamarin.Android project
It is a List or Grid or some Layout that have a Scroll Index, like this:
I already create a ListView with this "FastScroll Index" via Custom Renderer, which contains an Adapter and also a scroll listener.
Is there any chance to get something like in the image?
I have QFileDialog with 11 items in the filter. By default QComboBox shows 10 and for the rest you need to scroll - i.e. you have to scroll for 1 item. I would like to change it. QComboBox has maxVisibleItems property, but how can I access QFileDialog's filter combobox? I can see it in QDialogPrivate::qFileDialogUi->fileTypeCombo, but I don't have access to it.
Thanks!
The following solution only works for non native file dialogs (i.e. you must set the QFileDialog::DontUseNativeDialog flag).
In that case, QObject::findChild can be used to find the combobox in the widget. The following example assumes the dialog has only one combobox. If thats not the case, you must find the correct one via QObject::findChilden, which returns a list of all children.
Example code could look like this:
auto dialog = new QFileDialog(parent);
dialog->setOptions(QFileDialog::DontUseNativeDialog);
auto cBox = dialog->findChild<QComboBox*>();
if(cBox)
cBox->setMaxVisibleItems(11);
else
qCritical() << "Unable to find any combobox child";
//setup and show
Important: If you can't find the child, it's possible you have to first show the dialog before you can modify the box. In that case, place the code after the show call, and it might work.
I made simple listview in javafx. If I press a key, loaded the data from database to list from like query. Now I want to select the 1st item in list view at key released. I try to do this from listview.getselectionmodel ().selectfirst () method. It select the 1st item as temporary. If I want to move up or down on the list, I happen to give a mouse click to list and then I can move up or down from arrow keys. But I don't want this manner. I want, if I give key released,the data loaded and that moment i can up or down on listview from arrow keys. What should I do? Please help me
To move focus to your ListView, call requestFocus().
// in your handler
listView.getItems().addAll(Arrays.asList("item1", "item2", "item3"));
listView.getSelectionModel().selectFirst();
Platform.runLater(listView::requestFocus);
Focused ListView will accepts key operations immediately.
I have a popover which contains a tableview, once a row has been selected I want to then push on a UIImagePickerController.
According to the documents on the Apple website, I can only present this in a new view controller. How do I present a popover, in a popover? Or is there another way to do it?
The easiest way is to create a delegate and dismiss the tableview on didSelectRowAtIndex using either an exit unWind segue or by dismissing the popover manually using a delegate. Then present the popOver containing the UIImagePickerController. You could also just use the delegate to display a popover along with the tableview although that probably would look cluttered.
I am trying to use Qtreewidget as listview (like in C#) to display some data. As seen on the image below, while new datas displayed during the runtime, the widget doesn't focus on the last entry.That is what I want but couldn't find a method to make it focus on the last entry. In other words, I want it to be scrolled down to the last entry. Is there any way to do it or do I have to use something another to handle this ?
Thanks in advance.
Maybe this code will helps you:
QTreeWidget *mytree = new QTreeWidget(this);
...
mytree->scrollToBottom();