小编Ped*_*nço的帖子

从 Android 中的过渡动画中排除 BottomNavigation

我一直在四处搜索,但找不到有助于解决此特定问题的答案。我的应用程序有一个自定义的滑入、滑出效果,如下所示:

Intent intent = new Intent(getApplicationContext(), MyActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_right_in, R.anim.slide_right_out);
Run Code Online (Sandbox Code Playgroud)

问题

问题是我在所有活动中都包含了一个底部导航,我不希望它被动画化,我想排除它。

在此处输入图片说明

我正在努力实现的目标

我想从动画中排除底部导航。或者,换句话说,我怎样才能在转换之间只为内容设置动画?

在此处输入图片说明

编辑:我已经尝试过使用共享元素,但我希望它在 API 21 下工作。

animation android android-animation android-layout android-view

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

异步加载/附加JS脚本

我正在使用Laravel来实现基于主页的模板.不同的页面有不同的JS脚本,所以我创建了一个模板来导入JS脚本:

<!-- jQuery 2.1.3 -->
<script src="{{ URL::asset('plugins/jQuery/jQuery-2.1.4.min.js') }}"></script>

<!-- Bootstrap 3.3.2 JS -->
<script src="{{ URL::asset('js/bootstrap.min.js') }}" type="text/javascript"></script>

<!-- Ajax Page Loading -->
<script>
    function ajax(url) {
        $('.main-content').fadeOut(100); //hide the page
        $('.spinner').show(); // show a spinner
        $.ajax(url, {
            async: true,
            success: function(data) {
                $('#header').html(data[0]); //append received header to header
                $('#content').hide().html(data[1]).fadeIn(500); //show the page again
                $('body').append(data[2]); //append scripts to body
                $('.spinner').hide();
            },
        });
    }
</script>

@yield('extra-scripts') <--- /* HERE is where the scripts will be */
Run Code Online (Sandbox Code Playgroud)

我也使用AJAX只加载内容而不刷新页面.函数ajax将用于将任何url加载到div"content"中.但是,我还需要加载脚本以使页面正常工作.

数据是一个包含三个字段的数组: …

javascript ajax jquery laravel

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

SWITCH语句中的Java括号错误?

这真让我抓狂!我搜索了我的服装代码,似乎无法解决这个问题.这是我的代码:

class Subtarefas {
public static void resolve (int flag, int na, Aeroporto a[], int nv, Voo v[]) {
    switch(flag) {
        //------------------------------------------------------------------
        case 3: {//Incompleto
            String mat[][] = new String [na][2];
            int count=0;
            int bigcount=0;
            int indice=0;
            int np=0;

            for (int i=0; i<na; i++) {
                if ( indexOf(np, mat, a[i].nomecidade, a[i].nomepais)== -1 ) {
                    mat[np][0]=a[i].nomecidade;
                    mat[np][1]=a[i].nomepais;
                    np++;
                }
            }

            for (int i=0; i<np; i++) {
            count=0;
                for (int j=0; j<np; j++) {
                    if (mat[i][1].equals(mat[j][1])) count++;
                }
                if (count>bigcount) {bigcount=count; indice=i;} …
Run Code Online (Sandbox Code Playgroud)

java switch-statement

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

Haskell映射定义错误

我最近遇到了Haskell,在尝试编写我对map函数的定义时遇到了问题.示例:mapi(> 2)[1,2,3,4,5] = [False,False,True,True,True]

mapi _ [] = 0
mapi f (x:xs) = [f x] ++ mapi f xs
Run Code Online (Sandbox Code Playgroud)

当我尝试这个时,我得到错误:

No instance for (Num [Bool]) arising from a use of `mapi'
Possible fix: add an instance declaration for (Num [Bool])
In the expression: mapi (> 2) [1, 2, 3, 4, ....]
In an equation for `it': it = mapi (> 2) [1, 2, 3, ....]
Run Code Online (Sandbox Code Playgroud)

我知道它与:mapi _ [] = 0有关但我找不到问题,我的意思是,它必须停在[]上!

haskell

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

如何在DynamoDB中更新数组内的嵌套对象

考虑DynamoDB表中的以下文档项/语法:

{
    "id": "0f00b15e-83ee-4340-99ea-6cb890830d96",
    "name": "region-1",
    "controllers": [
        {
            "id": "93014cf0-bb05-4fbb-9466-d56ff51b1d22",
            "routes": [
                {
                    "direction": "N",
                    "cars": 0,
                    "sensors": [
                        {
                            "id": "e82c45a3-d356-41e4-977e-f7ec947aad46",
                            "light": true,
                        },
                        {
                            "id": "78a6883e-1ced-4727-9c94-2154e0eb6139",
                        }
                    ]
                }
            ]
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我的目标是更新此JSON表示形式的单个属性,在本例中为cars

我的方法

我知道所有传感器ID。因此,达到该属性的最简单方法是在数组中找到具有带有任何id的传感器路线。找到该传感器后,Dynamo应该知道他必须更新routes数组中的哪个对象。但是,如果不拒绝我的条件,我将无法运行此代码。

在这种情况下,请更新属性汽车,其中路线的ID为e82c45a3-d356-41e4-977e-f7ec947aad46或的传感器78a6883e-1ced-4727-9c94-2154e0eb6139

var params = {
    TableName: table,
    Key:{
        "id": "0f00b15e-83ee-4340-99ea-6cb890830d96",
        "name": "region-1"
    },
    UpdateExpression: "set controllers.intersections.routes.cars = :c",
    ConditionExpression: ""controllers.intersections.routes.sensors.id = :s",
    ExpressionAttributeValues:{
    ":c": 1,
    ":s": "e82c45a3-d356-41e4-977e-f7ec947aad46"
    },
    ReturnValues:"UPDATED_NEW"
};

docClient.update(params, …
Run Code Online (Sandbox Code Playgroud)

amazon-dynamodb

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