- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
希望这里有一个解决方案,我的 main.xml 中有一个 XML TimePicker 和 ScrollView,并且设置后 TimePicker 不会滚动。如果我删除 ScrollView,Timepicker 将滚动得很好,但显然我需要两者。
看起来他们都在为获得触摸事件而战,但这会导致问题。
这是我的代码:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@color/backgroundmain">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Action Title -->
<ImageView />
<TextView />
<!-- Description -->
<TextView />
<!-- Have to Button -->
<TextView />
<RelativeLayout
android:id="@+id/TimePickerSection"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="5dp"
android:layout_centerHorizontal="true"
android:layout_below="@id/">
<TimePicker
android:id="@+id/TimePick"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_below="@id/HaveToText"/>
<Button
android:id="@+id/OkButton"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/OkText"
android:layout_below="@id/HaveToText"
android:textSize="20sp"
android:onClick="TimePickButton"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/TimePick"/>
</RelativeLayout>
<!-- OR -->
<TextView />
<!-- buttons -->
<TextView />
<Button />
</RelativeLayout>
</ScrollView>
我删除了不相关的代码,但保留了轮廓只是为了向您展示布局的布局方式。
XML 中是否有修复?我尝试过 android:fillViewPort=""
之类的东西,但什么也没做。我的 TimePicker 不是对话框或任何东西的一部分,希望我能保持这种状态。
最佳答案
找到解决方案,创建一个自定义的 TimePicker 类,然后调用它来覆盖触摸事件:
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// Stop ScrollView from getting involved once you interact with the View
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
ViewParent p = getParent();
if (p != null)
p.requestDisallowInterceptTouchEvent(true);
}
return false;
}
关于android - ScrollView 与 TimePicker 的滚动打架,结果 Timepicker 不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14354006/
我正在制作一个提醒应用程序。它有一个 Activity ,您可以在其中看到警报和一个 float 操作按钮以添加新警报。从该按钮我的自定义对话框将打开以设置警报。它应该返回在 TimePicker 中
我正在尝试使用此插件将时间选择器放入表单中:http://jonthornton.github.io/jquery-timepicker/ .似乎我所要做的就是下载库并使用 jQuery 和 jQue
我正在使用 jQuery.timepicker(不确定这个插件的使用范围——它是由 Jon Thornton 创建的,Git:https://github.com/jonthornton/jquery
希望这里有一个解决方案,我的 main.xml 中有一个 XML TimePicker 和 ScrollView,并且设置后 TimePicker 不会滚动。如果我删除 ScrollView,Time
出于某种原因,我收到错误 $(...).timepicker is not a function 即使我在脑海中包含了 timpicker css 和 js 文件。它之前工作正常,所以我不确定我做了什
我正在尝试设置 minTime我的 结束时间 timepicker基于我在 中选择的内容开始时间 timepicker . 我有这个,基于适用于常规的东西 datepicker ,但它不起作用。 $(
我使用 ngx-material-timepicker timePicker 从 here 安装使用命令npm install --save ngx-material-timepicker我还安装了依
TimePicker uwp的控件有两个属性Time和SelectedTime。我阅读了微软的文档,但找不到两者之间的区别。当我打印两个值时,它们是相同的。谁能解释一下两者之间的区别? Debug.W
我已经构建了一个带有日期选择器和时间选择器的微调器格式的 View 。一切似乎都运行良好,只是我不知道如何将分钟设置为 5 分钟间隔? 我看到了如何使用 DialogFragment 执行此操作的示例
我在使用时间选择器时遇到问题,无法弄清楚我的问题是什么。这是我的代码; timePicker.timeZone = [NSTimeZone localTimeZone]; NSDate *select
我有一个表格,可以让我添加旅行时间和工作时间。例如,我可以知道我什么时候离开公司,什么时候到达客户,然后反过来。还有工作时间,我什么时候开始工作,什么时候去吃午饭,下午也是如此。这里的问题是我没有在下
我是 Android 新手,目前正在努力使用 TimePicker。所以,我在这里有 TimePicker: public class TimePickerFragment extends Dialo
在android项目中我有这个类 package mycalories.com.jalle.mycalories; import android.app.Dialog; import android.
试图找出Android中的时间选择器对话框。 我遇到的问题是,当我选择一个时间并将其放在我的 TextView 字段中时,所有前面的零都被删除了。 06:05 显示为 6:5。 如何保留前面的零? 我
我正在尝试构建一个 TimePickerDialog 但不幸的是,出现的时间选择器使用起来非常麻烦: 有什么方法可以像Android使用的旧时间选择器一样构建一个时间选择器,如下所示: 我的代码如下:
我正在努力弄清楚如何将时间选择器的下拉间隔设置为 15 分钟间隔。默认为 30 分钟 atm。让它工作的正确调用/符号是什么?我已经尝试了很多将它们放入 '' 的变体,但没有任何进展。谢谢! $
我有一个包含以下代码的 Activity 。 @Override public void onCreate(Bundle savedInstanceState) { super.onCreat
我正在使用这个 jquery 时间选择器:http://jonthornton.github.io/jquery-timepicker/ 它提供了一个开箱即用的输入下拉列表,其中小时数按 30 分钟递
我目前正在尝试将 jQuery Timepicker 插件嵌入到我的页面中,但不知何故它不起作用。我现在研究了几个小时,但无论是在 stackoverflow 上还是在博客上都没有帮助修复错误。 这是
我正在 Android 中创建一个非常基本的闹钟。当我在手机上构建和加载时,由于某种原因,时间选择器在中间被切断。 我试过更改 xml 中的高度,将高度设置为一个值,以及 wrap_content。
我是一名优秀的程序员,十分优秀!