小编Cod*_*rji的帖子

ListView行项目中的ViewPager

我已经阅读了很多关于这个问题的相关问题.然而,他们都没有得到回答.我试图在寻呼机内有两个布局ViewPagerListView地方的每一行添加一个.我相信这是可行的,因为SwipeListView.

现在我已经实现了它.但是,显示空白页面,中间有一条线.没有行出现.

在此输入图像描述

这是我的代码:

MainActivity + ArrayAdapter

public class MainActivity extends Activity {

    ListView list;
    String[] heros;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        heros = getResources().getStringArray(R.array.heros);

        list = (ListView) findViewById(R.id.listView1);
        list.setAdapter(new CustomAdapter(this, heros));
    }

    public class CustomAdapter extends ArrayAdapter<String>
    {
        String[] heros;
        Context context;
        public CustomAdapter(Context context, String[] heros) {
            super(context, R.layout.pager_item_list, R.id.listView1, heros);
            // TODO Auto-generated constructor stub
            this.heros = heros;
            this.context = context;
        }

        @Override
        public View getView(int position, View convertView, …
Run Code Online (Sandbox Code Playgroud)

android android-listview android-viewpager

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

如何将View添加到XML布局android

我有一个XML布局,包含我的所有按钮和图像,我想在我的布局顶部移动云.所以我创建了一个视图并使我的云移动,但是我无法将视图与布局链接起来.这是我的观看代码

public class CloudView extends View {

Bitmap cloud;
int ChangingX;


public CloudView(Context context) {
    // TODO Auto-generated constructor stub
    super(context);
    cloud = BitmapFactory.decodeResource(getResources(), R.drawable.cloud);
    ChangingX = 50;

}

@Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);
    canvas.drawBitmap(cloud, ChangingX , 50, null);
    if (ChangingX < canvas.getWidth())
        ChangingX += 2;
    else
        ChangingX = 50;
    invalidate();
}

}
Run Code Online (Sandbox Code Playgroud)

这是我的MainActivity

public class MainActivity extends Activity {

CloudView myView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    myView = new CloudView(this); …
Run Code Online (Sandbox Code Playgroud)

android view android-animation

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

Gunicorn 动态反映更改的代码

我正在开发一个 django Web 应用程序,用户可以在应用程序本身中使用ace 编辑器通过 UI 修改某些类的代码(可以将其视为 gitlab/github,您可以在其中在线更改代码)。但这些课程在某个时候是由 django 和 celery 工人运行的。

保存代码更改后,由于gunicorn,django 不会选择这些更改,但由于其过程不同,所以与 celery 一起工作正常。(使用本地运行它runserver工作正常,并且 django 和 celery 都会选择更改)。

有没有办法让gunicorn反映包含类的某些目录的更改,而无需重新加载整个应用程序?如果需要重新加载,有没有办法在不停机的情况下,一一重新加载gunicorn的worker?

枪械命令:

/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
Run Code Online (Sandbox Code Playgroud)

wsgi配置文件:

import os
import sys

from django.core.wsgi import get_wsgi_application

app_path = os.path.abspath(os.path.join(
    os.path.dirname(os.path.abspath(__file__)), os.pardir))
sys.path.append(os.path.join(app_path, 'an_application'))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")

application = get_wsgi_application()
Run Code Online (Sandbox Code Playgroud)

django gunicorn

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

我的java代码有什么问题?

我是java的新手,我正在尝试编写一个Linked-List Stack ..

public class Stack {

    private Node first;

    private class Node {
        int item;
        Node next;
    }

    public boolean IsEmpty()
    {
        return first==null;
    }

    public void push(int item)
    {
        Node oldfirst=first;
        first=new Node();
        first.item=item;
        first.next=oldfirst;
    }

    public int pop ()
    {
        int item=first.item;
        first=first.next;
        return item;
    }
}
Run Code Online (Sandbox Code Playgroud)
import javax.swing.*;

public class main {

    public static void main(String[] args) {
        Stack ob=null;
        int num=0;
        while (true)
        {
            num=Integer.parseInt(JOptionPane.showInputDialog("Enter the number"));
            ob.push(num);
            if (num==0)
                break;
        }
        int k;
        k=ob.pop(); …
Run Code Online (Sandbox Code Playgroud)

java stack nullpointerexception

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