小编MLa*_*oie的帖子

以编程方式禁用ScrollView?

我想启用ScrollView并通过按钮单击禁用它.
禁用意味着如果ScrollView不在那里..并启用它返回ScrollView.

我想要的是因为我有一个带有文本图像的图库,并且在按钮上单击屏幕方向更改,因此在横向文本中文本会变大.我想要ScrollView,因此图像不会伸展自身,文本变得不可读.

scrollview.Enabled=false / setVisibility(false) 没有做任何事情.

XML:

<ScrollView 
android:id="@+id/QuranGalleryScrollView" 
android:layout_height="fill_parent" 
android:layout_width="fill_parent">
<Gallery android:id="@+id/Gallery" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:scrollbars="horizontal"></Gallery>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

谢谢

Edit1:我不能使用Visibility(消失),因为那也会隐藏Gallery,我想要的是隐藏ScrollView的效果.当有ScrollView时,Gallery中的图像变为scrollabale并且不适合屏幕,所以你必须滚动才能看到整个图像,我不想在按钮点击时禁用/启用它.

我试过这个:

((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setOnTouchListener(null);
                        ((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setHorizontalScrollBarEnabled(false);
                        ((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setVerticalScrollBarEnabled(false);
                        ((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setEnabled(false);
Run Code Online (Sandbox Code Playgroud)

但是图库中的图像仍然是可滚动的,不适合屏幕..这是什么解决方案?

android android-scrollview

104
推荐指数
6
解决办法
11万
查看次数

Python正则表达式 - r前缀

任何人都可以解释为什么下面的示例1有效,何时r不使用前缀?我认为r只要使用转义序列,就必须使用前缀.示例2和示例3证明了这一点.

# example 1
import re
print (re.sub('\s+', ' ', 'hello     there      there'))
# prints 'hello there there' - not expected as r prefix is not used

# example 2
import re
print (re.sub(r'(\b\w+)(\s+\1\b)+', r'\1', 'hello     there      there'))
# prints 'hello     there' - as expected as r prefix is used

# example 3
import re
print (re.sub('(\b\w+)(\s+\1\b)+', '\1', 'hello     there      there'))
# prints 'hello     there      there' - as expected as r prefix is not used
Run Code Online (Sandbox Code Playgroud)

python regex string literals prefix

69
推荐指数
3
解决办法
7万
查看次数

缩放比例 在CSS3中缩放

我正在寻找一些我从未使用过的css属性,并了解zoomcss3的属性

  • 它们之间有什么相似之处和区别?

  • 何时使用Zoom和缩放?两者的工作差不多.

  • 哪个更有效使用,为什么?

我注意到了什么?

  • 两者都缩放对象但是默认变换原点用于缩放它的中心和缩放它的左上角我认为;

  • 当我们在悬停时使用它们进行缩放时,缩放将缩放并再次缩小到原始维度,而缩放只会在悬停时缩小. - >> jsfiddle显示悬停效果**

*
{
    -webkit-transition-duration: 0.3s;
	-moz-transition-duration: 0.3s;
	-ms-transition-duration: 0.3s;
	-o-transition-duration: 0.3s;
	transition-duration: 0.3s;
}

box, box2
{
    display: inline-block;
    width: 100px;
    height: 100px;
    
    margin: 20px;
}

box
{
    background: #b00;
}

box:hover
{
    zoom: 1.1;
}

box2
{
    background: #00b;
}

box2:hover
{
    -webkit-transform: scale(1.1);
	-moz-transform: scale(1.1);
	-ms-transform: scale(1.1);
	-o-transform: scale(1.1);
	transform: scale(1.1);
}
Run Code Online (Sandbox Code Playgroud)
<box></box>
<box2></box2>
Run Code Online (Sandbox Code Playgroud)


一些Stackoverflow QA

div {
  display: inline-block;
  height: 50px; …
Run Code Online (Sandbox Code Playgroud)

css dom zoom scale

50
推荐指数
2
解决办法
7万
查看次数

Leaflet.js将地图置于一组标记的中心

即时通讯使用Leaflet.js,并希望某种方式将地图置于我所拥有的标记上,以便在页面启动时所有都在用户视图中.如果所有标记都聚集在一个小区域中,我希望地图缩小到仍然显示所有标记的水平.

我知道谷歌地图有自动中心功能,但我如何使用Leaflet.js进行此操作?

markers leaflet

42
推荐指数
1
解决办法
3万
查看次数

使用ggplotly时如何选择变量显示在工具提示中?

我有一个简单的数据框:

seq <- 1:10
name <- c(paste0("company",1:10))
value <- c(250,125,50,40,40,30,20,20,10,10)
d <- data.frame(seq,name,value)
Run Code Online (Sandbox Code Playgroud)

我想以这种方式绘制它:

require(ggplot2)
ggplot(data = d,aes(x=seq,y=value))+geom_line() + geom_point()
Run Code Online (Sandbox Code Playgroud)

现在我想使用情节,主要是为了能够,当鼠标悬停在某一点上时,获取除价值之外的其他信息,例如公司名称.我试试这个:

require(plotly)
ggplotly()
Run Code Online (Sandbox Code Playgroud)

这给我一个工具提示,但只有seq和值.我尝试了选项tooltip =但它指定你可以使用美学中唯一的变量描述,我不会在我的使用中使用该名称.

有解决方案吗 我看到我不是第一个遇到这个问题的人,但我还没有找到与ggplotly合作的答案.

r ggplot2 plotly ggplotly r-plotly

29
推荐指数
4
解决办法
2万
查看次数

垂直和水平对齐(中间和中间)与css

我正在练习CSS,我很困惑,我怎么能强迫我的div元素在我的页面中心(垂直和水平)(意味着跨浏览器兼容性的方式或方式)?

最好的祝福 !

css xhtml alignment

28
推荐指数
1
解决办法
12万
查看次数

在Angular 2中加载延迟加载的模块时显示活动指示器

我的方案如下.我有一个菜单,有多个选项.应该根据用户权限(已经解决)显示每个菜单,大多数菜单项都封装为模块,并且大多数模块都是延迟加载的,因此当用户第一次单击菜单项时,它会加载(到此为止所有内容)效果很好),现在我的要求是,为了提供更好的用户体验,我需要在加载延迟加载的模块时用户点击菜单项后显示活动指示器.

到目前为止,我尝试使用canActive,canLoad,来自Angular Router的canActivateChild接口,但没有运气.

有任何想法吗?

lazy-loading angular2-routing angular

28
推荐指数
3
解决办法
1万
查看次数

angular6功能模块延迟加载抛出错误TypeError:undefined不是函数

我有这个代码app-routing.module.ts,根据角度的新文档,我通过该方法仍然没有工作,抛出一些我无法理解的错误.

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from "@angular/router";
import { HomeComponent } from "./home/home.component";
import { AdminModule } from "./admin/admin.module";

const routes: Routes = [
  {
    path: 'admin',
    loadChildren: './admin/admin.module#AdminModule'
  },
  { path: '', redirectTo: '/home', pathMatch: 'full' },
  { path: 'home', component: HomeComponent },
];

@NgModule({
  imports: [
    CommonModule,
    RouterModule.forRoot(routes)
  ],
  exports: [
    RouterModule
  ],
  declarations: []
 })
 export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

它抛出这样的错误.

我也试过像这样的旧方式 …

angular angular6

28
推荐指数
4
解决办法
9466
查看次数

为什么我收到此错误提前结束文件?

我试图解析XML response,但我失败了.我最初认为xml只是没有在回复中返回,所以我通过直接链接到我的xml文件在线制作了下面的代码.我能够毫无问题地打印XML到屏幕.但是,当我调用我的parse方法时,我得到文件的过早结束.

如果我直接传递URL,它可以工作:

  • builder.parse( "");

但是当我传递一个InputStream时失败:

  • builder.parse(connection.getInputStream());

      try {
        URL url = new URL(xml);
        URLConnection uc =  url.openConnection();
        HttpURLConnection  connection = (HttpURLConnection )uc;
    
        connection.setDoInput(true);
        connection.setDoOutput(true);
    
        InputStream instream;
        InputSource source;
        //get XML from InputStream
        if(connection.getResponseCode()>= 200){
            connection.connect();       
            instream = connection.getInputStream();         
            parseDoc(instream);     
        }
        else{
            instream = connection.getErrorStream();
        }
    
    
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ParserConfigurationException …
    Run Code Online (Sandbox Code Playgroud)

java xml httpurlconnection

26
推荐指数
2
解决办法
17万
查看次数

R中coord_flip后的反转顺序

dbv的数据示例:

  gender Sektion
1      m       5
2      m       5
3      w      3B
4      w      3B
5      w      3B
6      m       4
Run Code Online (Sandbox Code Playgroud)

我有以下情节:

Sekplot <- ggplot(dbv,aes(x=Sektion,
                          fill=factor(gender),
                          stat="bin", 
                          label = paste(round((..count..)/sum(..count..)*100), "%"))) 
Sekplot <- Sekplot + geom_bar(position="fill")
Sekplot <- Sekplot + scale_y_continuous(labels = percent)
Sekplot <- Sekplot + labs(title = "test")
Sekplot <- Sekplot + scale_fill_discrete(name="test", breaks=c("m", "w", "k.A."), labels=c("m", "w", "k.A."))
Sekplot <- Sekplot + geom_hline(aes(yintercept = ges, linetype = "test"), colour = "black", size = 0.75, show_guide = T) …
Run Code Online (Sandbox Code Playgroud)

r axes ggplot2

25
推荐指数
1
解决办法
1万
查看次数