小编Seb*_*nto的帖子

使用TabLayout的片段内的ScrollView不滚动,为什么?

我是一个在Android开发中的菜鸟,我在密码学的入门课程,所以我决定结合两个,并使这个应用程序.我使用TabLayout为每个密码方法(RSA和XOR)创建一个选项卡,并使用一个选项卡指示和帮助.一切都运行良好,直到我在帮助选项卡中添加了一个scrollView与说明.scrollView不滚动,我不知道为什么,我一直在网上寻求帮助,并做每个可行的解决方案,如更改宽度和高度ScrollView属性,我卡住了,你能帮我吗? 截图

-----编辑3/02/16 -----

**我的main_activity.xml**

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.example.usuario.chatparritos.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:elevation="4dp"
            android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

        <android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/toolbar"
            android:background="?attr/colorPrimary"
            android:elevation="6dp"
            android:minHeight="?attr/actionBarSize"
            app:tabMode="fixed"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

        <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/toolbar"
            tools:context="net.voidynullness.android.tabitytabs.TabLayoutActivity"
                                           android:background="#ffffff"/>

    </android.support.design.widget.AppBarLayout>


    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_info"/>

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

----- //编辑3/02/16 -----

这是我的tab_fragment_3.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:fillViewport="true"
            android:focusableInTouchMode="true"
            android:focusable="true"
            android:scrollbars="vertical"
            android:id="@id/scrollView">

    <LinearLayout android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:background="#FFFFFF"
                  android:layout_marginLeft="20dp"
                  android:layout_marginRight="20dp"
                  android:gravity="left"> …
Run Code Online (Sandbox Code Playgroud)

java xml android scrollview android-fragments

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

在 Flask 蓝图中导入 Celery

我有一个具有 MVC 结构的 Flask 应用程序:

my_app
??? server.py
??? requirements.txt
??? models
?   ??? __init__.py
    ??? model.py
??? controllers
    ??? __init__.py
    ??? client_controllers
        ???controller.py
    ??? another_controller.py
??? templates
Run Code Online (Sandbox Code Playgroud)

我使用蓝图在“控制器”中拆分服务器代码,所以我有这样的事情:

服务器.py:

from flask import Flask
from celery import Celery

from controllers.client_controllers.controller import controller

app = Flask(__name__)
app.secret_key = 'SECRET'

app.register_blueprint(controller)

# Celery Configuration
def make_celery(app):

    celery = Celery(app.import_name, backend=app.config['CELERY_RESULT_BACKEND'],
                    broker=app.config['CELERY_BROKER_URL'])
    celery.conf.update(app.config)
    TaskBase = celery.Task
    class ContextTask(TaskBase):
        abstract = True
        def __call__(self, *args, **kwargs):
            with app.app_context():
                return TaskBase.__call__(self, *args, **kwargs)
    celery.Task = …
Run Code Online (Sandbox Code Playgroud)

python celery flask

4
推荐指数
2
解决办法
1745
查看次数

在 Peewee Models Python 中创建“查询方法”

我在烧瓶项目中使用 Peewee 进行 MySQL 连接。我想知道是否可以在模型的方法中进行查询。这将使路由代码更清晰,例如:

人物.py:

from peewee import *

db = SqliteDatabase('people.db')

class Person(Model):
    name = CharField()
    birthday = DateField()
    is_relative = BooleanField()

    class Meta:
        database = db # This model uses the "people.db" database.

    def getPersonByName(name):
        #logic to get persons by name
        #return result
Run Code Online (Sandbox Code Playgroud)

服务器.py:

 .
 .
 .
 @app.route('/<name>')
 def index(name):
     persons = Person.getPersonByName(name)
     return render_template('names.html', persons=persons)
Run Code Online (Sandbox Code Playgroud)

python flask peewee

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

标签 统计

flask ×2

python ×2

android ×1

android-fragments ×1

celery ×1

java ×1

peewee ×1

scrollview ×1

xml ×1