spinner 相关问题

Spinner是一个小部件,允许用户从组中选择一个项目,如下拉列表。

角度材质进度微调器和进度栏不显示

我正在开发 Angular 4。我做了一个新项目: ng 新的测试应用程序 然后我跑了: npm install --save @Angular/Material @Angular/cdk ng g c 首先 应用程序模块.ts 导入 { BrowserModule } fr...

回答 3 投票 0

kotlin 上的微调器出现空指针异常

我在使用 onItemSelectedListener 实现 Spinner 时遇到了 Kotlin Android 代码问题。我正在尝试使用从 SQLite 数据库检索的数据填充 Spinner,b...

回答 1 投票 0

显示微调器,直到页面加载外部资源

我想显示一个微调器,直到页面完全加载(包括外部资源)。该页面正在显示横幅(广告),并且正在从广告服务器加载这些横幅和广告。 我正在使用...

回答 1 投票 0

如何将 CircularProgressIndicator 在按钮中垂直居中?

我想创建一个按钮,在禁用时显示一个 CircularProgressIndicator (用例:用户单击按钮,发出网络请求,在此期间,按钮通过一个漂亮的旋转被禁用......

回答 1 投票 0

将项目(文件)从目录添加到微调器列表

我正在尝试将目录中的文件添加到微调器列表中,但我什么也没有得到,(微调器列表为空)但文件夹中包含 3 个文件。 我检查了该文件夹是否存在,(如下...

回答 1 投票 0

Android - 删除微调器下拉箭头

我只是想知道是否可以简单地删除微调器的下拉箭头?我的微调器背景布局中有一个可绘制箭头,但是系统默认箭头出现...

回答 4 投票 0

如何让我的 Android Spinner 正常工作

根据我在互联网上找到的内容,我创建了一个 SpinnerPopup 来显示长时间运行任务的微调器。旋转器就在那里,最终会出现,但不是当我想要它漂亮的时候......

回答 1 投票 0

微调器下拉列表显示错误的值

我创建了一个微调器并将值设置为数组列表。但是当运行时下拉列表中显示错误的值。 我尝试在数组列表中添加一些值并将这些值设置为 spinner。但是 oi 出错了...

回答 1 投票 0

Kivy Spinner - 重视尺寸

有没有办法通过 Spinner 中的值参数更改文本大小?我发现我可以更改下拉框的高度和宽度并更改“标签”的大小......

回答 1 投票 0

延迟角度旋转而不闪烁

目前我正在尝试使用 Angular HttpInterceptor 显示一次旋转器,这样每次 HttpRequest 完成时它就不会闪烁。我当前的 Interceptor.service.ts 代码看起来像...

回答 2 投票 0

从 React Bootstrap 添加微调器

我想向我当前使用的模态添加一个微调器。 ... 我想向我当前使用的模态添加一个微调器。 <Modal show={modal.show} onHide={onHideModal}> <form onSubmit={onImport}> <Modal.Header closeButton> <Modal.Title>View Details</Modal.Title> </Modal.Header> <Modal.Body> <Form.Group controlId="csvFile" className="mb-3"> <Form.Label>Import CSV</Form.Label> <Form.Control type="file" accept='.csv, .xls, .xlsx' required className="primary mb-3" name="" onChange={onChangeImportFile} ref={inputFileRef} /> <Button variant="primary" className="me-2" type="submit" disabled={saving===true ? false : true}>Upload</Button> </Form.Group> <Form.Group className="mb-2"> <Form.Label>Message</Form.Label> <Form.Control as="textarea" readOnly value={fileError} rows={5} /> </Form.Group> </Modal.Body> <Modal.Footer> <Button variant="secondary" onClick={clearModal}> Clear </Button> <Button variant="secondary" onClick={onHideModal} className="me-auto"> Close </Button> </Modal.Footer> </form> </Modal> 我想点击提交,如果数据很大,它会显示微调器。截至目前,它看起来像是坏了,但过了一会儿所有数据都会发送出去。 我尝试在其中添加此内容,但我不太确定如何设置它以在单击提交按钮时显示加载。 <Spinner animation="border" role="status" variant="primary"> <span className="visually-hidden">Loading...</span> </Spinner> 尝试使用 useState 变量来改变 spinner 的出现 就像,当您单击“提交”按钮时,应该会显示微调器。 以下是如何将微调器添加到上传大数据时显示的模式中: 添加加载状态变量: const [loading, setLoading] = useState(false); 更新 onImport 功能: 开始上传之前将loading设置为true: const onImport = async (event) => { event.preventDefault(); // prevent form submission setLoading(true); // set loading state to true // ... your existing submit logic with data processing and upload ... try { // ... setLoading(false); // set loading state back to false after successful upload // ... after successful upload logic like closing modal, showing success message etc. } catch (error) { setLoading(false); // set loading state back to false on error // ... error handling logic } }; 有条件地渲染微调器: 用 React.Fragment 包裹按钮或模态主体,并仅在加载为 true 时渲染微调器: <Modal show={modal.show} onHide={onHideModal}> <form onSubmit={onImport}> <Modal.Header closeButton> <Modal.Title>View Details</Modal.Title> </Modal.Header> <Modal.Body> <React.Fragment> {loading && ( <Spinner animation="border" role="status" variant="primary"> <span className="visually-hidden">Loading...</span> </Spinner> )} <Form.Group controlId="csvFile" className="mb-3"> ... // your existing form group content ... </Form.Group> <Form.Group className="mb-2"> ... // your existing message form group content ... </Form.Group> </React.Fragment> </Modal.Body> <Modal.Footer> ... // your existing modal footer buttons ... </Modal.Footer> </form> </Modal> (可选)加载时禁用按钮: 向提交按钮添加 disabled={loading} 属性,以防止上传时进一步点击: <Button variant="primary" className="me-2" type="submit" disabled={loading}>Upload</Button>

回答 2 投票 0

Android:为什么自定义微调器的getView被多次调用

我制作了 3 个下拉旋转器并制作了旋转器适配器,并为每个旋转器设置了 setAdapters。但问题是,当我点击下拉Spinner项时,我从Spinner Adap的getView中调用......

回答 1 投票 0

Razor 页面在等待 OnGetAsync 时显示微调器打开

我试图在处理 OnGetAsync 时显示一个微调器。 我有一个看起来像这样的表格: <... 我正在尝试在我的 OnGetAsync 处理时显示旋转器。 我有一个看起来像这样的表格: <form method="get"> <div class="row"> <button type="submit" class="btn btn-primary" name="action" value="1">1</button> <button type="submit" class="btn btn-primary" name="action" value="2">2</button> </div> </form> 通过添加触发 jquery .show() 方法的 onclick,我已经能够在按下按钮时显示我的微调器。然而,当我的OnGetAsync返回时,我没有什么好办法阻止它。 处理此类事情的正确方法是什么? 在razor项目中,c#无法在客户端运行,这里有另一个类似问题提到过,所以我们最好控制加载是否显示。由于您没有提供最小样本,所以我用下面的代码进行了测试: <form method="get"> <div class="row"> @* <button type="submit" class="btn btn-primary" name="action" value="1">1</button> <button type="submit" class="btn btn-primary" name="action" value="2">2</button> *@ <button id="showImg">show loading</button> </div> </form> <div id="loadImg" style="display:none;"> <img style="width:50px;height:50px;" src="~/loading.gif" /> </div> @section Scripts{ <script> $("#showImg").click(function(){ $("#loadImg").show(); }); </script> } public class IndexModel : PageModel { public IActionResult OnGet() { return Page(); } } 这是测试结果。 由于我在方法中有一个return Page(),每次调用onGet时,整个页面都会重新加载,这样我的加载图标就会默认不可见。如果我们想像ajax那样重新加载页面的一部分,那么所有这些都应该由js来控制。例如,在onclick事件中,我们可能会发送一个ajax请求,在发送请求之前,我们可以调用.show()方法来显示加载图标,并且在回调方法中,我们可以调用.hide()方法使其不可见.

回答 1 投票 0

WPF 加载旋转器

目标是显示应用程序正在运行的信息。所以我正在寻找使用 WPF / MVVM 的加载旋转器的智能实现示例。

回答 15 投票 0

Spinner 不应用 dropDownSelector 属性

我正在使用微调器并想要添加微调器 - 改变行为取决于状态(聚焦、按下) 示例项目在这里 https://github.com/vovs/spinner_issue 我的代码: 活动主文件 我正在使用微调器并想要添加微调器 - 改变行为取决于状态(聚焦、按下) 示例项目在这里https://github.com/vovs/spinner_issue 我的代码: activity_main.xml <Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="30dp" android:spinnerMode="dropdown" android:dropDownSelector="@drawable/spinner_state" /> spinner_state.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@color/black" /> <item android:state_pressed="true" android:state_enabled="true" android:drawable="@color/red" /> <item android:state_focused="true" android:state_enabled="true" android:drawable="@color/red" /> <item android:state_enabled="true" android:drawable="@color/gray" /> </selector> AndroidManifest: <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> 因此,如果我在模拟器 Android 4.0.2 API 14 中运行应用程序并尝试选择某些项目或使用鼠标滚轮滚动,则不会有任何效果,我在选择器中设置(当按下或滚动时 - 项目应该是红色的,但它为蓝色 - ICS 颜色的默认值)。 对于 Android 2.2 API 8,当按下或使用滚轮滚动时(在这种情况下状态为焦点)颜色为黄色[橙色](Android 2.2 的默认颜色) 如何启用微调器的选择器? 也是一个官方错误... https://code.google.com/p/android/issues/detail?id=24922 有什么帮助: <resources> <style name="Theme.MyTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:dropDownListViewStyle">@style/Theme.MyListView</item> </style> <style name="Theme.MyListView" parent="@android:style/Widget.Holo.Light.ListView"> <item name="android:listSelector">@drawable/orange_list</item> </style> </resources> 祝你好运! <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:drawable="@color/lighter_gray_no_transparent" /> <item android:state_selected="true" android:drawable="@color/lighter_gray_no_transparent" /> <item android:state_pressed="true" android:drawable="@color/lighter_gray_no_transparent" /> <item android:drawable="@android:color/transparent"/> </selector> <color name="lighter_gray_no_transparent">#FFDDDDDD</color> 为您的项目视图设置背景选择器,仅此而已。为我工作。 颜色alpha值必须为FF,否则会显示橙色背景,左边一个颜色值是#FFDDDDDD,右边一个是#55DDDDDD 可能还有其他方法,但这是我从使用其中一个生成器中了解到的。 在指向您的可绘制对象的 res/values/styles.xml 中声明您自己的微调器样式。 <style name="myCustomSpinner" parent="android:Widget.Holo.Light.Spinner"> <item name="android:background">@drawable/spinner_state</item> </style> 创建res/values/themes.xml并声明继承当前主题的您自己的主题。在此主题中,为您要修改的每个属性添加一个项目,并将其指向上一步中的自定义样式。我认为如果您愿意,这可以放入样式文件中,但由于生成器将它们分开,所以我也照着做。 <style name="myCustomTheme" parent="android:Theme.Light"> <item name="android:dropDownSpinnerStyle">@style/myCustomSpinner</item> </style> 在您的 AndroidManifest 中,将 android:theme="@style/myCustomTheme" 添加到起始 application 标签。 您的 parent 值将取决于项目的设置方式,我认为这将决定项目中旋转器的样式,而不仅仅是一个。尝试一下,让我知道你得到了什么。 这是另一个类似于 es0329 给出的解决方案: <style name="Base.Theme.SpinnerDemo" parent="Theme.Material3.DayNight.NoActionBar"> <item name="android:dropDownListViewStyle">@style/My.Theme.Spinner</item> </style> <style name="My.Theme.Spinner" parent= "android:Widget.ListView"> <item name="android:divider">@null</item> <item name="android:listSelector">@drawable/spinner_selector</item> </style> 这是我对其如何以及为何起作用的解释。 为什么android:dropDownSelector不起作用? 这一切都取决于我们单击微调器时发生的情况。单击后,它将经历一个创建DropDownListView的过程。 在创建过程中,它将使用内置属性R.attr.dropDownListViewStyle来创建AbsListView。 然后,AbsListView 将从 R.styleable.AbsListView_listSelector attr 中提取可绘制对象,这将成为选择器: final Drawable selector = a.getDrawable(R.styleable.AbsListView_listSelector); if (selector != null) { setSelector(selector); } 因此,我们赋予 Spinner 的 android:dropDownSelector 对于为弹出窗口创建的 AbsListView 没有任何影响。 这就是为什么为了实际设置选择器,我们需要更改主题中的android:listSelector。 为什么使用android:Widget.ListView作为主题的父主题? 如果我们查看我们的应用程序主题,我们应该发现类似这样的内容: <style name="{THEME_NAME}" parent="{PARENT_THEME}"> <item name="dropDownListViewStyle">?android:attr/dropDownListViewStyle</item> <item name="android:dropDownListViewStyle">@style/Widget.AppCompat.ListView.DropDown</item> </style> 在我的例子中,dropDownListViewStyle默认是@style/Widget.AppCompat.ListView.DropDown,它继承自android:Widget.ListView: <style name="Base.Widget.AppCompat.ListView" parent="android:Widget.ListView"> <item name="android:listSelector">?attr/listChoiceBackgroundIndicator</item> </style> 所以为了不搞乱其他设置,我决定使用 android:Widget.ListView 作为父级并更改 android:listSelector 的属性。

回答 4 投票 0

如何处理所选项目上的多个旋转器?我不知道该怎么办

私有无效getData(){ //创建字符串请求 StringRequest stringRequest = new StringRequest(Config.DATA_URL, 新的 Response.Listener() { @欧维...

回答 2 投票 0

当背景设置为自定义微调器 xml 文件时,微调器箭头消失?

我想向我的微调器添加边框和圆角,我知道这可以通过创建单独的自定义微调器 xml 文件来完成。然而,当我这样做时,旋转箭头消失了。这个

回答 1 投票 0

如何通过javascript手动显示选项卡加载指示器?

我说的是页面加载期间显示在选项卡上的图标。 铬合金: Firefox(带有 TreeTab 插件): 你明白了。我想让页面看起来像是正在加载,当它正常时......

回答 4 投票 0

如何在 TextView 中创建下拉文本 - Android

我想在Android中创建一个TextView,当单击它时,它会显示其余的文本,即类似于导入语句的隐藏/显示,其中 单击减号/加号显示/隐藏其余的...

回答 3 投票 0

Angular ngx-spinner 未显示

我需要显示微调器,直到从 httpclient 获取数据。但微调器没有显示。 我只需要显示微调器或加载器,直到数据来自 API,以便用户可以看到数据

回答 7 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.