listview

Pass object to dynamically loaded ListView ItemTemplate

你说的曾经没有我的故事 提交于 2020-02-23 03:59:33
问题 I have been following the following post on using multiple ItemTemplates in a ListView control. While following this example does produce output, I am trying ot figure out how to psas an object through to the ItemTemplate's user control, which I do not seem to be able to do/figure out. protected void lvwComments_OnItemCreated(object sender, ListViewItemEventArgs e) { ListViewDataItem currentItem = (e.Item as ListViewDataItem); Comment comment = (Comment)currentItem.DataItem; if (comment ==

ListView Horizontal Fling Gesture

有些话、适合烂在心里 提交于 2020-02-20 08:50:13
问题 I have a listview that displays entries for a given date. There are buttons above the listview that allow you to increase/decrease the date. Everything works. What I'm looking to do is replace those buttons and have the user swipe right/left to increase/decrease the date. What's the best way to go about this? I don't care what item is swiped, often there will be no items in the listview for a given date, just as long as it happens on the listview area. I do have click and longclick listeners

SwiftUI Row Height of List - how to control?

£可爱£侵袭症+ 提交于 2020-02-20 07:53:46
问题 I have a simple List in SwiftUI. Code and Screenshot included below. I would like to reduce the height of each row in the list (so less space between lines and text lines closer together). I already tried to add a ".frame(height: 20)" to the HStack but it only allows the line spacing to be increased! Is there a way to do that? Thanks! Gerard import SwiftUI struct PressureData: Identifiable { let id: Int let timeStamp: String let pressureVal: Int } struct ContentView : View { @State var

Android Studio 学习笔记(四):Adapter和RecyclerView说明

醉酒当歌 提交于 2020-02-18 21:36:40
在现版本中,滚动控件有多种,而相比于ListView,GridView,RecyclerView的用途更广,因此将前两者作为Adapter适配器的引入,再对RecyclerView进行简单讲解。 MVC & Adapter 为了方便理解,这里介绍一下Android应用设计的基础,也就是MVC架构,如图。 控制器(Controller)- 可看作一个中间桥梁,响应来自View的用户交互,通过对View设定的事件逻辑修改Model,再回传实现View的数据刷新。 视图(View) - 用户看到的图形界面,由界面设计人员负责。 模型(Model) - 保存数据状态,其中由程序员编写程序应有的功能(实现算法等等)、数据库专家进行数据管理和数据库设计(可以实现具体的功能)。 MVC架构:Model(数据)以Controller(控制器)设定的方式呈现在View(用户界面)中。 简而言之:Adapter在其中充当Controller(控制器)的角色,在其中设定每一个元素长什么样子,怎么排列各个元素的逻辑,再把包含代码逻辑的复杂数据按设定好的样式给View。其中自带的BaseAdapter用得最多。 常见用法是新建一个类继承自BaseAdapter,重写其中的方法并构造新的方法,结合ListView、GridView控件使用。 ListView和GridView的用法相似,只是功能不同

ListView与ArrayAdapter(二)

我的梦境 提交于 2020-02-18 07:31:36
ArrayAdapter: 数组适配器,用于简单的文字列表 activity_main.xml <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" > <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/lv"> </ListView> </RelativeLayout> Mainactivity.java package com.example.arrayadapter; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget

How to change listview item background color using if condition Android

我的未来我决定 提交于 2020-02-16 11:31:07
问题 I'm creating an app with listview and I added few values like 101,102 to 110 to the listview. Now I have to change the listview item background colour using edittext. For example if I type 101 and click submit button, background colour of 101 should change. Please help. Please...... 回答1: First Declare the layout of adapter linearlayout = itemView.findViewById(R.id.linearLayout); then set color if match the number in onBindViewHolder() if((position.Value())==typedValue){ holder.linearlayout

Wpf multiple listviews with shared selection (MVVM) [duplicate]

北慕城南 提交于 2020-02-16 10:41:15
问题 This question already has answers here : How to bind multiple selection of listview to viewmodel? (9 answers) Sync SelectedItems in a muliselect listbox with a collection in ViewModel (10 answers) Binding SelectedItems of Listview (2 answers) Closed 16 days ago . I have an issue with multiple listviews. I want them to have shared selection and SelectionMode=Extended I managed to find a solution if SelectionMode=Single but it doesn't work for Extended situation Basicly my code looks like this

Wpf multiple listviews with shared selection (MVVM) [duplicate]

。_饼干妹妹 提交于 2020-02-16 10:40:34
问题 This question already has answers here : How to bind multiple selection of listview to viewmodel? (9 answers) Sync SelectedItems in a muliselect listbox with a collection in ViewModel (10 answers) Binding SelectedItems of Listview (2 answers) Closed 16 days ago . I have an issue with multiple listviews. I want them to have shared selection and SelectionMode=Extended I managed to find a solution if SelectionMode=Single but it doesn't work for Extended situation Basicly my code looks like this

Android ListView ArrayAdapter 的简单使用

大城市里の小女人 提交于 2020-02-16 06:26:46
前面写了3篇关于android的文章,其中的演示程序都写在了一个工程中,当时为了方便测试就在启动页MainActivity中放了3个按钮,点击不同的按钮进入不同的示例程序页面,MainActivity的界面如下截图: 按照上面的设计,每写一个演示程序就需要在MainActivity中新增一个按钮并为其写点击事件,感觉这样有点麻烦,于是想改进一下,顺便用一下ListView和ArrayAdapter。经过改进后的启动页如下图: 新建了一个MainActivity2,用一个ListView来展现演示程序列表,点击相应列表项就跳转到相应的演示页面,功能和之前的MainActivity一样,但之后就不需要不断添加按钮及其点击事件了,只需要为每个演示页面添加一行代码: catalogs.add(new Catalog("演示的名称", 要跳转到的Activity.class)),这样就简洁多了,具体代码如下。 MainActivity2布局文件如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height=

ListActivity的使用

我们两清 提交于 2020-02-15 06:40:25
第一种情况,就是 extends Activity ,而且事先也 setContentView(R.layout.main); 那么我定义的ListView就是在XML里面已经布局好了的。 18. public class aGirlGallery extends Activity { 19. /** Called when the activity is first created. */ 20. @Override 21. public void onCreate(Bundle savedInstanceState) { 22. super .onCreate(savedInstanceState); 23. setContentView(R.layout.main); 24. 25. // 绑定Layout里面的ListView 26. ListView list = (ListView) findViewById(R.id.lv); 27. 28. // 生成动态数组,加入数据 29. ArrayList<hashmap <String, Object>> listItem = new ArrayList</hashmap><hashmap <String, Object>>(); 30. for ( int i = 0 ; i < 10 ; i++) { 31.