小编Olc*_*taş的帖子

CreateStreamedFileFromUriAsync:我如何传递IRandomAccessStreamReference?

我试图使用StorageFile方法 下载文件,CreateStreamedFileFromUriAsync但我与IRandomAccessStreamReference参数混淆.我如何传递IRandomAccessStreamReference?这是一个界面.我该怎么办?

public static IAsyncOperation<StorageFile> CreateStreamedFileFromUriAsync(
    string displayNameWithExtension, 
    Uri uri, 
    IRandomAccessStreamReference thumbnail
)
Run Code Online (Sandbox Code Playgroud)

c# uri storagefile

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

将数组元素与"\n"合并到Swift中的String中

我正在尝试合并字符串数组\n,但没有得到任何解决方案.我有以下类型的数组,其中包含节名称.

let arrSectionName = [
    "Section 1",
    "Section 2",
    "Section 3",
    "Section 4",
    "Section 5",
    "Section 6",
]
Run Code Online (Sandbox Code Playgroud)

现在,我想从上面的数组中获取此字符串:

"第1节\n第2节\n第3节\n第4节\n第5节\n第6节"

所以最后消息应显示如下:

警报消息输出:

    Following section which are still pending to complete, please verify and try again:
    Section 1
    Section 2
    Section 3
    Section 4
    Section 5
    Section 6
Run Code Online (Sandbox Code Playgroud)

节名称是动态的,将更改运行时和存储arrSectionName.

arrays string ios swift

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

AAPT:错误:找不到属性 android:killAble

我创建自定义属性使用BindingAdapter,但它无法在布局中使用

绑定适配器

@BindingAdapter("android:killAble")
fun View.setKillAble(killAble: Boolean) {
    this.isEnabled = killAble
}
Run Code Online (Sandbox Code Playgroud)

布局

<EditText
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:inputType="number"
    android:ems="10"
    android:id="@+id/et_height"
    android:killAble="true"
    android:layout_marginTop="32dp"
    app:layout_constraintTop_toBottomOf="@+id/et_name"
    android:layout_marginStart="16dp"
    app:layout_constraintStart_toStartOf="parent"
    android:layout_marginLeft="16dp"
    android:layout_marginEnd="16dp"
    app:layout_constraintEnd_toEndOf="parent"
    android:layout_marginRight="16dp"
    />
Run Code Online (Sandbox Code Playgroud)

HomeFragment.kt

class HomeFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 
             savedInstanceState: Bundle?): View? {
        val binding: FragmentHomeBinding = DataBindingUtil.inflate(inflater, 
        R.layout.fragment_home, container, false)
        val rootView = binding.root
        val viewmodel=ViewModelProviders.of(this).get(HomeViewModel::class.java)
        binding.lifecycleOwner = this
        binding.viewModel = viewmodel
        return rootView
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮我

android

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

WebStorm:为 React Native 设置模拟器 ID

当我运行我的React Native应用程序时,默认WebStorm启动模拟器。iPhone XWebStorm 的 React Native文档指出:

\n\n
\n

如果您选中了该Build and launch复选框,请选择目标平台,Android或者iOS。根据您的选择,将使用或WebStorm运行\n 捆绑程序react-native run-iosreact-native run-android.

\n\n

(可选)键入要传递给 React Native 的参数,例如,通过标志指定模拟器类型\xe2\x80\x91\xe2\x80\x91simulator:\n \xe2\x80\x91\xe2\x80\x91simulator="iPhone 4s"。

\n
\n\n

我已将标志设置为iPhone Xs Max如下所示:

\n\n

在此输入图像描述

\n\n

但它仍然启动iPhone X:

\n\n
react-native-cli run-ios "\xe2\x80\x91\xe2\x80\x91simulator=iPhone Xs Max"\ninfo Found Xcode project MyProject.xcodeproj\ninfo Building using "xcodebuild -project MyProject.xcodeproj -configuration Debug\n    -scheme MyProject \n    -destination id=0299DF16-DD84-40FB-8B37-55FC7EFCE271\n    -derivedDataPath build/MyProject"\n
Run Code Online (Sandbox Code Playgroud)\n\n

该id0299DF16-DD84-40FB-8B37-55FC7EFCE271 …

ios ios-simulator webstorm react-native

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

无法在JPanel上绘制椭圆

我有一个使用Netbeans的GUI构建器创建的JFrame,它只包含一个JPanel.我创建了一个getPanel获取此JPanel引用的方法:

public class ShowDrawings extends JFrame {

    public ShowDrawings() {
        initComponents();
    }

    public JPanel getPanel(){
        return panel;
    }

    private JPanel panel;
}
Run Code Online (Sandbox Code Playgroud)

在我的主要功能中我正在做:

public class Main {
    public static void main(String[] args){
        ShowDrawings sd = new ShowDrawings();
        sd.setSize(800, 600);
        Graphics g = sd.getPanel().getGraphics();
        g.setColor(Color.BLACK);
        g.drawOval(400, 300, 50, 50);
        sd.getPanel().paint(g);
        sd.repaint();
        sd.setVisible(true);
    }
}
Run Code Online (Sandbox Code Playgroud)

但它没有任何吸引力.请帮我.我已经看了一些相关的问题,但他们都建议扩展JPanel和覆盖其paint方法.但我不想这样做.谢谢.

java swing java-2d jpanel paintcomponent

2
推荐指数
1
解决办法
7434
查看次数

Xcode:缺少自动调整预览窗口

我正在学习iOS并使用Apress - Beggining iOS 5开发书.该书说有一个窗口可以在尺寸检查器中预览UI元素的自动调整行为:
在此输入图像描述

但我看不到这样的窗户.在Xcode窗口中搜索后,我意识到窗口实际上在很短的时间内出现,同时将大小检查器切换到实用程序选项卡中的任何其他部分.我怎样才能让它一直出现?

utilities xcode4.6

2
推荐指数
1
解决办法
5574
查看次数

Apache Mina:调用connect时出现IllegalStateException

我正在尝试使用Apache Mina在Android上创建一个简单的消息应用程序.我IllegalStateException打电话的时候才知道connect(new InetSocketAddress(HOSTNAME, PORT)).

这是我的客户端代码:http:
//pastebin.com/NR2H6X0t

这是我的服务器代码:http:
//pastebin.com/Q5fQnu2p

这是logcat输出:

http://pastebin.com/Egsh0Ce4

我正在使用平板电脑和手机在同一个wifi网络中测试我的应用程序.

android apache-mina

2
推荐指数
1
解决办法
214
查看次数

Android:ValueAnimator始终提供最终价值

我在下面的方法中将我的ValueAnimator配置为两种颜色之间的淡入淡出。但这是行不通的。它总是给出结束颜色值。

Integer colorFrom;
Integer colorTo;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGoogleApiClient = buildGoogleApiClient();
    activity = getActivity();
    context = activity.getApplicationContext();
    colorFrom = ContextCompat.getColor(context, R.color.donut_finished_color);
    colorTo = ContextCompat.getColor(context, R.color.Red);
}

@Override
public void onResume() {
    super.onResume();
    setColorAnimation();
}

private void setColorAnimation() {
    long passedTime = Calendar.getInstance().getTime().getTime() - currentEarlyDate.getTime();
    colorAnimator = ValueAnimator.ofObject(argbEvaluator, colorFrom, colorTo);
    colorAnimator.setDuration(currentPrayerTimeLength);
    colorAnimator.setInterpolator(null);
    colorAnimator.addUpdateListener(this);
    colorAnimator.start();
    colorAnimator.setCurrentPlayTime(passedTime);
}

@Override
public void onAnimationUpdate(ValueAnimator animation) {
    Integer colorValue = (Integer) colorAnimator.getAnimatedValue();
    Log.e(Constants.LOG_TAG, "Duration : " + colorAnimator.getDuration());
    Log.e(Constants.LOG_TAG, "Current : " + …
Run Code Online (Sandbox Code Playgroud)

animation android

2
推荐指数
1
解决办法
308
查看次数

如何在 React 中创建有序编号列表

我需要在其中创建一个有序列表,React并且我正在 render() 中执行以下操作

render() {
    <div key ={category.index}>
        question.map(questionlist =>
        <li key={questionlist.key}>{questionlist.description}</li>)}
    </div>
}
Run Code Online (Sandbox Code Playgroud)

reactjs

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

如何更改抽屉标题高度

所以我想改变抽屉的标题高度,因为我打算让抽屉成为一个设置页面。但目前它太厚了。我该怎么做。到目前为止,这是我的示例代码:

return Drawer(
  child: ListView(
    padding: EdgeInsets.zero,
    children: <Widget>[
      DrawerHeader(
        child: Text('Settings'),
      ),
    ]
  )
);
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

2
推荐指数
1
解决办法
4851
查看次数

ReferenceError:未知选项:.present

你好,我刚刚为 React JS 设置了环境,它给了我错误 ReferenceError: Unknown option: .present. ,这里是.babelrc webpack.config.js,package.json和react.js(文件)的代码

.babelrc

{
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react"
  ]
}
Run Code Online (Sandbox Code Playgroud)

webpack.config.js :

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './react.js',
output:{
    path: path.join(__dirname, '/frapp'),
    filename: 'bundled.js'
},
devServer:{
    inline: true,
    port: 8001
},
module: {
    rules: [
        {
           test: /\.jsx?$/,
           exclude: /node_modules/,
           loader: 'babel-loader',
           query:{
             present:['es2015', 'react']
           }
        }
    ]
},
  plugins: [
    new HtmlWebpackPlugin({
        template: './index.html'
    })
  ]
}
Run Code Online (Sandbox Code Playgroud)

包.json: …

reactjs webpack babeljs

2
推荐指数
1
解决办法
9127
查看次数

Java - JPA:如何为每个子类创建一个表,而不是为超类创建一个表?

我有一个类结构,如:

abstract class A {
    String a;
}

class B extends A {
    String b;
}

class C extends A {
    String c;
}
Run Code Online (Sandbox Code Playgroud)

现在我希望JPA为每个子类创建一个表.

在此输入图像描述

我看过一些以前的问题,但我很困惑.我该如何映射这些类?

java inheritance abstract-class jpa subclass

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

Swift IOS 使用 AVFoundation 录制视频和音频

我能够通过在此处解决此问题来成功获取录制的视频

基本上

  1. 从AVCaptureFileOutputRecordingDelegate原型继承
  2. 循环访问可用设备
  3. 使用相机创建会话
  4. 开始录音
  5. 停止录音
  6. 通过实现上述原型的方法获取录制视频

但该文件不附带音频。

根据这个问题,我必须单独录制音频并使用提到的类合并视频和音频

但我不知道如何同时实现视频和音频录制。

for device in devices {
    // Make sure this particular device supports video
    if (device.hasMediaType(AVMediaTypeVideo)) {
        // Finally check the position and confirm we've got the back camera
        if(device.position == AVCaptureDevicePosition.Back) {
            captureDevice = device as? AVCaptureDevice
            if captureDevice != nil {
                print("Capture device found")

                beginSession()
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在这个循环中,只有可用的设备类型是 .Front 和 .Back

avfoundation ios swift

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