小编AZ_*_*AZ_的帖子

一个gradle文件中的多个maven存储库

所以我的问题是如何将多个maven存储库添加到一个gradle文件中.

这不起作用:

repositories {
    mavenCentral()
    maven {
        url "http://maven.springframework.org/release"
        url "http://maven.restlet.org"
    }
}
Run Code Online (Sandbox Code Playgroud)

multiple-repositories gradle maven

274
推荐指数
2
解决办法
10万
查看次数

如何获得android.widget.ImageView的宽度和高度?

????????????????????????????????????????????????   ^
? ImageView    ????????????????                ?   |
?              ?              ?                ?   |
?              ? Actual image ?                ?   |
?              ?              ?                ?   |60px height of ImageView
?              ?              ?                ?   |
?              ?              ?                ?   |
?              ????????????????                ?   |
????????????????????????????????????????????????   
<------------------------------------------------>
                   90px width of ImageView
Run Code Online (Sandbox Code Playgroud)

我有一个默认高度和宽度的图像视图,图像存储在数据库中,我想根据Imageview高度宽度缩放图像.因为我不希望它给出默认值,因为当我改变它的高度和宽度时我也必须在代码中更改它.

我试图获得ImageView的高度和宽度,但在两种情况下都返回0.

int height = ((ImageView) v.findViewById(R.id.img_ItemView)).getHeight();
Run Code Online (Sandbox Code Playgroud)

即使它有默认的高度和宽度,这也会返回0

height android image width

270
推荐指数
7
解决办法
14万
查看次数

如何从ArrayList或String数组中删除所有null元素?

我试着用这样的循环

// ArrayList tourists

for (Tourist t : tourists) {
    if (t != null) {     
        t.setId(idForm); 
    }   
}
Run Code Online (Sandbox Code Playgroud)

但这并不好.谁能建议我一个更好的解决方案?


一些有用的基准可以做出更好的决策:

while循环,For循环和Iterator性能测试

java performance loops for-loop arraylist

179
推荐指数
9
解决办法
18万
查看次数

如何在Windows 7上安装Windows Phone 8 SDK

我拥有自己的所有工作空间以及在Windows 7上设置的所有内容,但我也想开发Windows Phone 8,但正如Microsoft网站上所述,它无法在Windows 7上安装.

有人知道如何在Windows 7上安装.我发现了一个破解但我不知道如何运行它.你可以从这里得到这个 请告诉我是否有人知道如何安装它.这是WP 8 ISO文件的链接

编辑:

在Windows 7中安装WP 8可能有几个原因.就像我最近购买了Wndows 7而我现在不想转向Windows 8,因为我对它的UI感觉不舒服.它更适用于平板电脑或触摸屏电脑.

我已经在Windows 7上设置了我的所有工作空间和其他项目,我不想浪费我的时间来设置Windows 8,我甚至不知道他们如何在Windows 8上执行.所以有这样的很多真正的原因.

installation windows-7-x64 windows-phone-8

66
推荐指数
2
解决办法
11万
查看次数

如何使用Otto事件总线将事件从Service发送到Activity?

简单的BusProvider.getInstance().post()不是例外main thread.如何使用Otto事件总线将事件从Service发送到Activity?

android otto

58
推荐指数
2
解决办法
3万
查看次数

android listview获取所选项目

我是android的新手,我有一个代码,我在列表视图中放置了按钮.我的清单是......

Number | Name | ID (visibility = gone) | Level | button1 | button2
Run Code Online (Sandbox Code Playgroud)

按钮1和按钮2的情况不同.我已经在按钮上应用了监听器,但是当我尝试从列表中获取ID时,它总是向我显示最后一个ID.

如何知道单击了哪个按钮,相关字段的名称和ID.

我在按钮上放置了按钮和监听器getView(...).

android listview selecteditem onclick

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

如何判断操作系统是Windows XP还是更高版本?

我正在尝试使用该Environment.OSVersion.Version对象,并且无法确定哪个版本表明操作系统是Windows XP或更高版本(例如,我想要排除Windows 2000,ME或以前的版本).

c# windows windows-xp version .net-2.0

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

样式GridSplitter wpf C#

我想为我的GridSplitter设置样式,就像添加点一样(如http://msdn.microsoft.com/en-us/library/aa970265.aspx上所示).

我还想在mouseOver上更改gridsplitter颜色,或者应用Aero Theme.

<Style x:Key="GridSplitterStyle1" TargetType="{x:Type GridSplitter}">
  <Setter Property="Background"
          Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
  <Setter Property="PreviewStyle">
    <Setter.Value>
      <Style>
        <Setter Property="Control.Template">
          <Setter.Value>
            <ControlTemplate>
              <Rectangle Fill="#80000000"/>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
    </Setter.Value>
  </Setter>
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type GridSplitter}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"/>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

<!--Theme-->
<ResourceDictionary.MergedDictionaries>
  <ResourceDictionary 
   Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml" />
</ResourceDictionary.MergedDictionaries>

<GridSplitter x:Name="gridSplitterTreeNodes" Width="10"
              BorderThickness="1,0" Cursor="SizeWE"
              RenderTransformOrigin="-1.2,0.507" ShowsPreview="True" 
              Style="{DynamicResource GridSplitterStyle1}">
  <GridSplitter.Background>
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      <GradientStop Color="#FFE3EFFF" Offset="0"/>
      <GradientStop Color="#FFAFD2FF" Offset=".45"/>
    </LinearGradientBrush>
  </GridSplitter.Background>
</GridSplitter>
Run Code Online (Sandbox Code Playgroud)

wpf templating styling wpf-controls gridsplitter

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

如何在IIS Express Server中创建新的applicationhost.config文件?

我不得不删除我的applicationhost.config,因为VS 1012没有处理他.我该如何创建它?谢谢.

iis visual-studio iis-express visual-studio-2012

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

Android:BLE如何读取多个特征?

用于读取某些特征的Android BLE API方法本质上是异步的,当您请求某些值时,将调用您的GATT回调方法.

如果您请求多个读取特征值,它只会丢弃其他值,直到它不接受第一个请求为止.

我不明白是否这样,为什么他们制作方法Async.如果有人知道我们应该采用哪种设计模式来解决这个问题,请分享.

如果你想阅读一些特征,那么你必须要求它.

// new value available will be notified in Callback Object
        mBluetoothGatt.readCharacteristic(ch);
Run Code Online (Sandbox Code Playgroud)

GATT回调

public void onCharacteristicRead(BluetoothGatt gatt, android.bluetooth.BluetoothGattCharacteristic characteristic, int status)
Run Code Online (Sandbox Code Playgroud)

可能的解决方案#1

https://code.google.com/p/guava-libraries/wiki/ListenableFutureExplained

任何人都可以解释如何使用它.我认为这将有助于这种情况,但我仍然在寻找如何使用它.

可能的解决方案#2

https://code.google.com/p/mobility-rpc/source/browse/mobility-rpc/trunk/src/main/java/com/googlecode/mobilityrpc/session/impl/MobilitySessionImpl.java#395

可能的解决方案#3

http://tutorials.jenkov.com/java-util-concurrent/synchronousqueue.html

可能的解决方案#4

http://examples.javacodegeeks.com/core-java/util/concurrent/synchronous-queue-example-to-execute-commands/

可能的解决方案#5

/sf/answers/1107159651/

更新

我已经成功地使用Queue更好的SynchronousQueue,但我会在测试后分享我的最终解决方案.指定超时,否则它将被卡住或者您请求读取不支持读取操作的特性.

您可以看到哪些特性是可读写的,请参阅此帖子

android asynchronous bluetooth-lowenergy

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