小编Dol*_*rma的帖子

Flutter:“RenderFlex 子项具有非零 flex,但传入的高度约束是无界的”

ListView当我FutureBuilder用 a包装时,我想在另一个小部件内部有一个小部件Column,以便有一个简单的Row. 我收到此错误:

The following assertion was thrown during performLayout():
I/flutter (13816): RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I/flutter (13816): When a column is in a parent that does not provide a finite height constraint, for example, if it is
I/flutter (13816): in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
I/flutter (13816): flex on a child (e.g. using Expanded) …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

52
推荐指数
3
解决办法
7万
查看次数

Android获得自定义Dialog的全宽

在我的应用程序中,我创建的自定义对话框没有完整的高度,我无法更改和自定义.例如看到这个屏幕截图:

在此输入图像描述 我的代码:

final Dialog contacts_dialog = new Dialog(ActivityGroup.this, R.style.theme_sms_receive_dialog);
contacts_dialog.setContentView(R.layout.dialog_schedule_date_time);
contacts_dialog.setCancelable(true);
contacts_dialog.setCanceledOnTouchOutside(true);
contacts_dialog.show();
Run Code Online (Sandbox Code Playgroud)

布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layoutRoot"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@null"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape_header_dialog_background"
        android:orientation="horizontal"
        android:padding="4dp" >

        <TextView
            android:id="@+id/TextView21"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginRight="5dp"
            android:layout_weight="2"
            android:gravity="center_vertical|right"
            android:text="@string/choose_schedule_time_date"
            android:textColor="#ffffff"
            android:textSize="14sp"
            android:textStyle="bold" />

        <ImageView
            android:id="@+id/ImageView03"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_marginTop="0dp"
            android:background="@drawable/icon_scudule_time" />
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

样式:

<style name="theme_sms_receive_dialog" parent="android:style/Theme.Dialog">
    <item name="android:windowNoTitle">true</item>
    <item name="android:background">@android:color/transparent</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="numberPickerStyle">@style/NPWidget.Holo.Light.NumberPicker</item>
</style>
Run Code Online (Sandbox Code Playgroud)

android android-layout android-dialog

46
推荐指数
8
解决办法
6万
查看次数

如何以编程方式创建android形状背景?

如何以编程方式创建此形状?

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="rectangle">

    <solid android:color="#e67e22"/> 
    <corners
        android:topLeftRadius="0dp"
        android:topRightRadius="0dp"
        android:bottomLeftRadius="5dp"
        android:bottomRightRadius="5dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

我尝试过这个简单的功能,可以获得角落,颜色和设置形状:

    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.category_header);

    GradientDrawable drawable = (GradientDrawable) linearLayout.getDrawable();

    float[] values = { 0.2f, 0.2f, 0.2f, 0.2f };
    drawable.setCornerRadii(values);
Run Code Online (Sandbox Code Playgroud)

但我得到了这个错误:

对于LinearLayout类型,方法getDrawable()未定义

android android-layout

44
推荐指数
5
解决办法
4万
查看次数

Laravel在验证中的数字之间设置

在laravel验证器的简单使用规则中,我想检查1到10之间的输入.

以下角色无法正常工作并接受零

'required|integer|digits_between:1,10'
Run Code Online (Sandbox Code Playgroud)

要么

'display_post_count' => 'required|min:1|max:10',
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-4

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

未找到名为"kapt"的Android配置

我正在尝试Realm在我添加的项目中使用数据库

classpath "io.realm:realm-gradle-plugin:5.9.0"
Run Code Online (Sandbox Code Playgroud)

build.gradle

apply plugin: 'realm-android'
Run Code Online (Sandbox Code Playgroud)

到模块build.gradle,点击同步后我得到这个错误:

Configuration with name 'kapt' not found.
Run Code Online (Sandbox Code Playgroud)

build.gradle 内容:

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
        classpath 'com.novoda:bintray-release:0.9'
        classpath "io.realm:realm-gradle-plugin:5.9.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
Run Code Online (Sandbox Code Playgroud)

build.gradle 模块内容:

apply …
Run Code Online (Sandbox Code Playgroud)

android

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

ajax请求中的laravel TokenMismatchException

我正在使用资源组并使用此过滤器来解决TokenMismatchException问题:

Route::filter('csrf', function($route, $request) {
    if (strtoupper($request -> getMethod()) === 'GET') {
        return;
        // get requests are not CSRF protected
    }

    $token = $request -> ajax() ? $request -> header('X-CSRF-Token') : Input::get('_token');

    if (Session::token() != $token) {
        throw new Illuminate\Session\TokenMismatchException;
    }
});
Run Code Online (Sandbox Code Playgroud)

我的路线:

Route::group(array('prefix'=> 'admin', 'before' => 'csrf'), function(){
    Route::resource('profile' , 'ProfileController', array('as'=>'profile') );
});
Run Code Online (Sandbox Code Playgroud)

现在.我收到Ajax请求的错误,例如这段代码:

<script type="text/javascript">
    $(document).ready(function() {
       $('#frm').submit(function(e){
           e.preventDefault();
           name         = $('#name').val();
           family       = $('#family').val();
           email        = $('#email').val();
           currPassword = $('#currPassword').val();
           password     = $('#password').val();
           password_confirmation …
Run Code Online (Sandbox Code Playgroud)

php ajax laravel laravel-4

26
推荐指数
3
解决办法
3万
查看次数

Android如何在recyclerview上获取用户滚动到项目的当前位置

在我的RecyclerView我有一些项目,用户可以滚动,看到,现在我想保存这个位置并滚动后回来,这下面的代码总是返回0,我不能保存

recyclerMarketLists.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
    @Override
    public void onScrollChanged() {
        recyclerViewCurrentScrolledPosition = recyclerMarketLists.getScrollY();
        Log.e("Y: ", recyclerViewCurrentSceolledPosition + "");
    }
});
Run Code Online (Sandbox Code Playgroud)

Logcat:

07-07 18:28:30.919 2124-2124/com.sample.presentationproject E/Y:: 0
Run Code Online (Sandbox Code Playgroud)

android android-recyclerview

24
推荐指数
4
解决办法
3万
查看次数

Laravel Soft删除帖子

在我们的项目中,我们必须对每个帖子使用软删除.在laravel文档中,我认为我们只能将此功能用于表格.

我们可以将它用于桌面上的帖子,例如

$id = Contents::find( $id );
$id->softDeletes();
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-4

19
推荐指数
4
解决办法
8万
查看次数

Android 出现错误:未指定命名空间

我决定使用最新版本并Gradle更新后出现此错误,但无法解决AndroidManifest.xmlbuild.gradle

错误:

Namespace not specified. Please specify a namespace in the module's build.gradle file like so:

android {
    namespace 'com.example.namespace'
}

If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
Run Code Online (Sandbox Code Playgroud)

应用build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:8.0.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Run Code Online (Sandbox Code Playgroud)

gradle.wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml

Namespace not specified. Please specify a namespace …
Run Code Online (Sandbox Code Playgroud)

android gradle build.gradle flutter

19
推荐指数
4
解决办法
3万
查看次数

找出 ListView 中的哪些项目可见

如何找出当前visibleinvisible在 中的项目ListView
例如,我有 100 个项目ListView,当我滚动到屏幕或列表顶部时,我想检测哪些项目从视口中出现或消失。

插图:

在此处输入图片说明

dart flutter flutter-layout flutter-listview

16
推荐指数
2
解决办法
8859
查看次数