我有一个HTML文本字段,我已经做了READONLY.然而,事实上,该领域只有100像素宽.我有一个句子,例如,没有显示在100像素.因为它是READONLY它不可滚动.
换一种说法.我怎么还能让这个字段不可编辑.但是也可以这样做,以便更长的字符串不适合在该领域,可见?
谢谢!
我正在使用bind/unbind进行鼠标滚轮滚动,基于此SO响应:
Jquery,取消绑定mousewheel事件,然后在操作完成后重新绑定它?
我正在从delta中挖掘事件树,仅定位X鼠标轮值.一切都运作良好.我正在努力解决的问题:我想简单地向前/向后滚动一个面板,然后停止滚动.目前,我在移动后立即解除鼠标滚轮事件的绑定,并且有效地停止了滚动...但是解除鼠标滚轮事件的绑定也会使页面突然显示.我需要的是能够嗅探方向的第一个deltaX值,然后移动并停止收听.我是否需要自动寻找答案?绑定/解除绑定感觉很糟糕,但我不能,为了我的生活,想出如何在一次移动后踢出,同时仍然能够在移动完成后滚动.这是我的鼠标滚轮功能:
function mouseHandler(event, delta) {
$('.homeScrollable').bind('mousewheel', mouseHandler);
var deltaX = event.originalEvent.wheelDeltaX;
//console.log(event.originalEvent.wheelDeltaX);
if(deltaX <= 0) {
//move forward 1 screen and stop
scrollapi.move(1);
$('.homeScrollable').unbind('mousewheel', mouseHandler);
} else if(deltaX > 0) {
//move backward 1 screen and stop
scrollapi.move(-1);
$('.homeScrollable').unbind('mousewheel', mouseHandler);
}
event.preventDefault();
// Rebind mousewheel event:
$('.homeScrollable').bind('mousewheel', mouseHandler); };
Run Code Online (Sandbox Code Playgroud)
我也看过设定一个计时器,一个la:
jquery mousewheel插件:如何每次滚动只触发一个函数
这似乎令人难以置信,但没有去.这是这个人的插件页面:http: //brandonaaron.net/code/mousewheel/docs
感谢检查出来.
我有一个自定义控件,可以放大自定义绘制的文档画布.
我尝试使用AutoScroll,但它没有给出满意的结果.当我将AutoScrollPosition和AutoScrollMinSize背靠背(以任何顺序)设置时,它会强制绘画并在每次变焦时引起抖动.我假设这是因为它修改了两个属性时调用了Update而不是Invalidate.
我现在手动设置HorizontalScroll和VerticalScroll属性,AutoScroll设置为false,因为每次缩放级别或客户端大小更改时:
int canvasWidth = (int)Math.Ceiling(Image.Width * Zoom) + PageMargins.Horizontal;
int canvasHeight = (int)Math.Ceiling(Image.Height * Zoom) + PageMargins.Vertical;
HorizontalScroll.Maximum = canvasWidth;
HorizontalScroll.LargeChange = ClientSize.Width;
VerticalScroll.Maximum = canvasHeight;
VerticalScroll.LargeChange = ClientSize.Height;
if (canvasWidth > ClientSize.Width)
{
HorizontalScroll.Visible = true;
}
else
{
HorizontalScroll.Visible = false;
HorizontalScroll.Value = 0;
}
if (canvasHeight > ClientSize.Height)
{
VerticalScroll.Visible = true;
}
else
{
VerticalScroll.Visible = false;
VerticalScroll.Value = 0;
}
int focusX = (int)Math.Floor((FocusPoint.X * Zoom) + PageMargins.Left);
int focusY = …Run Code Online (Sandbox Code Playgroud) 我在 CustomSrollView 中使用以下 SliverToBoxAdapter:
SliverToBoxAdapter(
child: Stack(
children: <Widget>[
Container(
width: double.infinity,
height: 50,
decoration: BoxDecoration(color: pink),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: ListView.builder(
padding: const EdgeInsets.all(0),
shrinkWrap: true,
itemBuilder: (context, index) {
return buildSongRow(songs[index]);
},
itemCount: songs.length,
),
)
],
))
Run Code Online (Sandbox Code Playgroud)
问题是列表不滚动,这很明显,因为它有框约束。我在这里使用 SliverToBoxAdapter,因为我必须将我的列表堆叠在列表顶部的某个 Container 上。如何让我的列表滚动?如果使用 SliverToBoxAdapter 无法完成,我还有其他选择吗?
我正在使用 Jetpack Compose 制作一个项目。我想像 Instagram 一样显示评论。有一个包含注释的数组。
这是用于显示评论的代码:
val i : Int
for(i in 1..user.count) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(10.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
Row(
verticalAlignment = Alignment.CenterVertically
) {
Image1(
painter = painterResource(id = user.pp),
contentDescription = "PP",
modifier = Modifier
.clip(CircleShape)
.size(50.dp)
)
Spacer(modifier = Modifier.width(10.dp))
Column() {
Row() {
Text(text = user.name, color = Color.Black, fontSize = 20.sp)
Spacer(modifier = Modifier.width(10.dp))
}
Spacer(modifier = Modifier.width(10.dp))
Text(text = "Public", color = Color.DarkGray, fontSize = 13.sp)
} …Run Code Online (Sandbox Code Playgroud) android scrollable kotlin android-jetpack android-jetpack-compose
实现Scrollable接口需要实现getPreferredScrollableViewportSize()方法.这通常只需将调用转发到getPreferredSize()来完成 - 除非Scrollable的其他参数可能影响首选的JViewport大小,例如JTree中的setVisibleRowCount()方法.
我有一种情况,我认为这种方法可以帮助我实现我的目标,但在我的getPreferredScrollableViewportSize()实现中的一个简单的print语句确认它永远不会被调用.搜索JScrollPane,ScrollPaneLayout和JViewport确认没有(直接)调用该方法.然而,JScrollPane中的注释明确指出ScrollPaneLayout使用它,我可以确认它是在JTree中按预期实现的.
什么时候调用,什么类(大概是LayoutManager)和什么时候?我正在使用JDK 1.7_07
我有一个 Bootstrap 构建的网站,其中包含一个覆盖页脚,单击页脚菜单即可打开该页脚。
页脚内部是一个可滚动的内容区域,当在可滚动 div 上设置固定高度时,该区域可以正常工作。由于网站是响应式的,我需要这个可滚动区域的百分比高度似乎延伸到可见窗口之外。
一个例子在这里: http: //jsfiddle.net/JUESu/5/
#footer-content {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: black;
opacity: 1;
display: block;
color: #7f7f7f;
height:85%;
}
.scrollable {
overflow-y: scroll;
height: 50%; /* Doesnt Work */
/*height: 300px; /* Works */
width: 95%;
background: red;
}
Run Code Online (Sandbox Code Playgroud)
如何在固定位置容器内放置可滚动的 div?
我有一个包含内容的 UIScroll 视图。如果该内容溢出,使滚动视图可滚动,我想将视图的底部设置为某种颜色。如果没有,我想将其设置为不同的颜色。
我的问题是,我不知道如何检测 UIScrollView 的内容是否溢出并因此可以滚动。
我正在尝试在gridview上方显示一个搜索栏(来自流构建器)。希望搜索栏与gridview一起向上滚动。我尝试了多种方法将它们包装在扩展的/灵活的小部件中,但是我总是会遇到错误。有人管理过这个吗?
这就是我现在所拥有的内容,它将滚动但搜索栏位于顶部。
new Column(
children: <Widget>[
new Flexible(
child: new Column(
children: <Widget>[
new Container(
margin: new EdgeInsets.only(left: 4.0, right: 4.0),
color: Colors.white,
child: new Row(
children: <Widget>[
new Container(
margin: new EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0, bottom: 8.0),
child: Icon(Icons.search),
),
new Container(
child: Flexible(
child: new TextField(
onChanged: (String text) {
setState(() {
_searchController.text = text;
});
},
decoration: new InputDecoration.collapsed(hintText: 'Search...'),
controller: _searchController,
),
)
),
],
),
),
new Flexible(
child: new StreamBuilder(
stream: stgDocument.collection('people').orderBy('scroll').snapshots(), …Run Code Online (Sandbox Code Playgroud) 我创建了两个表单,并将它们添加到一个 PageView。每个表单有 6 个 TextFormField。当我点击最后 2 个 TextFormField 时,键盘会显示在这些字段上并隐藏它们。我需要的是当我点击每个字段并且键盘可见时向上滚动表单以显示这些字段。对于这种方法,我尝试像示例中那样在 PageView 下使用 SingleChildScrollView,但它没有做我需要的。我怎样才能解决这个问题?
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
body: PageView(
children: <Widget>[
_sampleForm(),
_sampleForm(),
],
),
)
}
_sampleForm(){
return Container(
margin: const EdgeInsets.fromLTRB(0, 0, 0, 10),
width: MediaQuery.of(context).size.width,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Form(
child: Column(
children: <Widget>[
TextFormField(...),
TextFormField(...),
TextFormField(...),
TextFormField(...),
TextFormField(...),
TextFormField(...),
],
),
),
],
),
),
);
}
Run Code Online (Sandbox Code Playgroud) scrollable ×10
flutter ×3
android ×1
c# ×1
controls ×1
css ×1
css-position ×1
dart ×1
field ×1
html ×1
java ×1
jquery ×1
jscrollpane ×1
jviewport ×1
kotlin ×1
list ×1
listview ×1
mousewheel ×1
pageviews ×1
readonly ×1
swift3 ×1
swing ×1
uiscrollview ×1
winforms ×1