小编ZZe*_*aNN的帖子

Android:使用图像路径设置布局背景

我想把图像作为布局的背景.

首先,我正在创建一个drawable: Drawable d = Drawable.createFromPath("pathToImageFile");

API级别8 layout.setBackground( d )不支持layout.setBackgroundDrawable( d ) 不推荐使用 ,所以我需要使用

layout.setBackgroundResource(resourceID)

如何获取动态生成的drawable的resourceID.我正在使用此方法:

Drawable d = Drawable.createFromPath("pathToImageFile");

创造一个可绘制的.

android background drawable resource-id

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

扩展RecyclerView:错误膨胀类com.example.MyRecyclerView

我想禁用RecyclerView的滚动.为此,我试图MyRecyclerView通过扩展来定义自定义RecyclerView.

MyRecyclerView.java

package com.example;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.MotionEvent;

class MyRecyclerView extends RecyclerView {
    private boolean scrollable = true;

    public MyRecyclerView(Context context) {
        super(context);
    }

    public void setScrollingEnabled(boolean scrollable) {
        this.scrollable = scrollable;
    }

    public boolean isScrollable() {
        return scrollable;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                // if we can scroll pass the event to the superclass
                if (scrollable) return super.onTouchEvent(ev);
                // only continue to handle the touch event …
Run Code Online (Sandbox Code Playgroud)

android extend android-custom-view android-5.0-lollipop android-recyclerview

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

Windows防火墙在Windows Server 2012 r2上阻止IIS上的FTP

我已按照此指南Windows Server 2012 R2上成功设置了FTP.我可以通过登录到ftp并在完全禁用Windows防火墙后查看我的文件.但即使连接也无法连接

  1. 我允许ftp通过防火墙.
  2. 我已经使用本教程配置数据通道端口.
  3. 我确保通过FTP允许相应的端口.

但是一旦启用了Windows防火墙,我就无法连接.任何帮助,将不胜感激.谢谢

iis ftp windows-firewall amazon-ec2 windows-server-2012-r2

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