我知道它已经被问到了,但我还没有找到答案(对Android来说很新,所以很抱歉无知)
我的应用程序的启动Activity有一个EditText(称为searchbox),一个ListView(名称)和一个Spinner(类型)
我使用EditText作为搜索框,我必须通过自定义编辑传递字符串,以使搜索更灵活.之后,我将其与我在'指定'中找到的最接近的近似值相匹配
designations.setSelection(j);
Run Code Online (Sandbox Code Playgroud)
正如所料,这将所需项目设置为指定的顶部.但我找不到通过代码突出显示它的方法.
现在,我知道如果设备处于触摸模式,则不会突出显示所选项目.所以我的搜索框的onTextChanged事件的最后4行是:
designations.setFocusable(true);
designations.setFocusableInTouchMode(true);
if (match==true) designations.setSelection(j);
if (st.length()==0) designations.setSelection(0);
Run Code Online (Sandbox Code Playgroud)
无济于事.
现在,我在searchbox的afterTextChanged(Editable s)上没有任何代码;
所以有人能给我一个线索吗?
问〜呃
我正在尝试将AVPlayerLayer用作SCNMaterial分配给SCNSphere.
基于:https: //developer.apple.com/library/mac/samplecode/SceneKit_Slides_WWDC2013/Listings/Scene_Kit_Session_WWDC_2013_Sources_Slides_ASCSlideMaterialLayer_m.html
我创建一个玩家,创建一个玩家图层并尝试使用和不使用backgroundLayer作为我的SCNSphere的材质
问题是,我得到了相同的结果: SCNMaterialProperty没有渲染层
音频播放,视频根本没有渲染!
代码很简单:
// video player
let path = NSBundle.mainBundle().pathForResource("tb", ofType: "mp4")
let url = NSURL(fileURLWithPath: path!)
let player = AVPlayer(URL: url) // AVPlayer
player.actionAtItemEnd = .None
player.play()
let frame = CGRectMake(0, 0, 300, 300)
let playerLayer = AVPlayerLayer()
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
playerLayer.frame = frame
playerLayer.player = player
sceneMaterial = SCNMaterial()
sceneMaterial.specular.contents = UIColor.whiteColor()
sceneMaterial.shininess = 0.5
sceneMaterial.diffuse.contents = playerLayer
sphere.materials = [sceneMaterial]
Run Code Online (Sandbox Code Playgroud)
如上所述,我是否使用backgroundLayer:CALayer并将playerLayer添加为子图层会产生相同的结果.
任何帮助表示赞赏
我试图找出如何在只有边框/笔划/边缘可见的情况下使用SCNScylinder.我场景中的所有东西都工作得很好,我正在考虑为specular.contents应用一个清晰的颜色
是否需要使用SCNNode委托/金属代码(我在我的场景中没有使用opengl)
有什么指针吗?帮助表示赞赏
这可能已经得到了回答,但我似乎无法找到答案。
iOS 13 引入了新的 UIBarButton.SystemItem 值.close。
我已经使用了新的代理外观 API,但无论我做什么,该特定图标(带有 X 的圆圈)的背景颜色都不会从带有深灰色 X 的半透明圆圈改变。
在过去的几个小时里一直在努力解决这个问题,希望之前有人遇到过这个问题
我下载了一个从服务器到我的文档文件夹的文件
文件存在且有效(在设备上使用iExplorer和模拟器的本地目录进行检查).将每个文件移动到我的桌面并播放没有问题.
奇怪的是,当文件(相同的视频)被添加到捆绑包时,完全相同的代码可以正常工作.
码:
print("video url string : \(video.urlString)")
// prints: /var/mobile/Containers/Data/Application/47AC756B-7A00-4FAE-9348-214972BE61BD/Documents/demo-reel.mp4
// file IS there
let asset = AVURLAsset(URL: NSURL(fileURLWithPath: video.urlString))
let keys = ["tracks","playable","duration"]
asset.loadValuesAsynchronouslyForKeys(keys, completionHandler: { () -> Void in
var error : NSError? = nil
let status = asset.statusOfValueForKey("tracks", error: &error)
switch status {
case .Failed:
print("failed \(error?.localizedDescription)")
case .Loaded:
print("loaded \(error?.localizedDescription)")
case .Loading:
print("loading \(error?.localizedDescription)")
case .Cancelled:
print("cancelled \(error?.localizedDescription)")
case .Unknown:
print("unknown \(error?.localizedDescription)")
}
prints: failed Optional("The requested URL was not found on this …Run Code Online (Sandbox Code Playgroud) 只是想知道这是否可能在Swift 2.2,KVO中计算属性!?
即:
var width = 0
var height = 0
private var area : Double {
get {
return with * height
}
}
self.addOberser(self, forKeyPath: "area", ......
Run Code Online (Sandbox Code Playgroud)
客户端代码是否会修改with或height触发器observeValueForKeyPath?
只需在参与市长类重构之前进行检查.KVO的语法很烦人,因为如果有人手头有答案,我甚至不值得去操场(我假设答案是否定的)
问候!〜d
key-value-observing foundation ios swift computed-properties
我对Java很新,我认为这和其他语言一样.
对于字符串:
String line = "3::Daniel::Louis||##2::Leon: the Professional::1994||6::Jean::Reno||7::Gary::Oldman||8::Natalie::Portman||##3::Scarface::1983||9::Al::Pacino||10::Michelle::Pfeiffer";
Run Code Online (Sandbox Code Playgroud)
我想把它分开||##.
但:
for(String s : line.split("||##")) {
System.out.println("|"+s+"|");
}
Run Code Online (Sandbox Code Playgroud)
收益:
||
|3|
|:|
|:|
|D|
|a|
|n|
|i|
Run Code Online (Sandbox Code Playgroud)
...等
我在期待:
3::Daniel::Louis
Leon: the Professional
Run Code Online (Sandbox Code Playgroud)
...等
我究竟做错了什么?
我正在使用ActionBarSherlock,我想用MenuItem.SHOW_AS_ACTION_ALWAYS在其中显示EditText.它需要条的整个宽度并根据需要显示.但是我在尝试添加TextWatcher时遇到了麻烦.
所以基于这里接受的答案:http://goo.gl/ite6h我写道:
EditText search;
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
menu.add(0, 1, 1, R.string.inlineSearch).setIcon(R.drawable.action_search).setActionView(search).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return super.onCreateOptionsMenu(menu);
}
private TextWatcher filterTextWatcher = new TextWatcher() {
public void afterTextChanged(Editable s) {
Log.e("TextWatcher","after");
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
Log.e("TextWatcher","before");
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
Log.e("TextWatcher","onText");
}
};
@Override
public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
Log.e("onOptions",""+item.getItemId()); // Line 150
switch (item.getItemId()) {
case 1:
search = (EditText) item.getActionView(); …Run Code Online (Sandbox Code Playgroud) android menuitem textwatcher android-edittext actionbarsherlock
这是一个非常简单的问题.
有没有办法为printf格式化float,使其具有xx SIGNIFICANT小数?
所以我不是说,%5.3f浮动,但如果我有
float x=0.00001899383
Run Code Online (Sandbox Code Playgroud)
我怎么会输出0.0000189,如果我想最多的前三个非零小数?
可以在Coca Touch中使用矢量吗?如果是这样,必须包含哪些库?
我正在关注他们的一般C教程,唯一需要的是 #include <vector>
但XCode声明没有这样的文件或目录.
任何指向提供此类功能的库的指针都是值得赞赏的.
问候~dhp
ios ×4
android ×2
avfoundation ×2
scenekit ×2
swift ×2
avkit ×1
avplayer ×1
avurlasset ×1
c ×1
calayer ×1
character ×1
cocoa ×1
cocoa-touch ×1
formatting ×1
foundation ×1
highlight ×1
ios13 ×1
java ×1
listview ×1
listviewitem ×1
menuitem ×1
metal ×1
numbers ×1
objective-c ×1
opengl-es ×1
printf ×1
render ×1
split ×1
string ×1
textwatcher ×1
tintcolor ×1
uiappearance ×1
vector ×1