小编Jul*_*ira的帖子

对从0dp宽度到MATCH_PARENT的视图进行动画处理

我正在尝试RecyclerView通过使矩形从零宽度增长到100%(MATCH_PARENT)并使其成为项目背景来对它进行动画处理。

但是我看不到动画的效果。我的意思是,初始背景为白色,但矩形为灰色,因此单击的项目将变为灰色。但是,这没有发生。

这是项目xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView 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="wrap_content"
    app:cardCornerRadius="0dp"
    android:focusable="true"
    android:clickable="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:orientation="horizontal">

        <View
            android:id="@+id/colored_bar"
            android:layout_width="3dp"
            android:layout_height="match_parent"
            android:background="@drawable/colored_bar_bg1"></View>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <View
                android:id="@+id/option_background_container"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:background="#e0e0e0"></View>

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingBottom="16dp"
                android:paddingTop="16dp">

                <ImageView
                    android:id="@+id/icon"
                    android:layout_width="48dp"
                    android:layout_height="48dp"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:layout_marginLeft="13dp"
                    app:srcCompat="@drawable/ic_lock" />

                <TextView
                    android:id="@+id/card_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_toEndOf="@+id/icon"
                    android:layout_toRightOf="@+id/icon"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:textColor="?android:attr/textColorPrimary"
                    android:textSize="16sp"
                    tools:text="@string/option_title_label" />

                <TextView
                    android:id="@+id/card_subtitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/card_title"
                    android:layout_toEndOf="@+id/icon"
                    android:layout_toRightOf="@+id/icon"
                    android:paddingLeft="8dp"
                    android:textSize="14sp"
                    tools:text="@string/option_description_label" />
            </RelativeLayout>
        </FrameLayout>
    </LinearLayout>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)

以及制作动画的代码: …

android android-animation

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

快速发电机与Swig

我正在尝试使用Express生成器来创建应用程序框架,但它似乎只适用于Jade和EJS.

我不喜欢Jade没有使用标签的想法,因为代码变得一团糟.我已经开始使用Swig,但在Express发生器上没有任何选项.

如何更快地使用Express和Swig创建这个通用结构?

node.js express swig-template

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

工具栏未显示或MapFragment未显示

我正在尝试将我的ActionBar迁移到AppCompat 21方式(使用设置为ActionBar的工具栏小部件),但它没有被显示或被MapFragment隐藏.

这是我的活动:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.br.myapp.fragments.MapFragment">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:dragView="@+id/name"
        sothree:fadeColor="@android:color/transparent"
        sothree:panelHeight="0dp"
        sothree:paralaxOffset="100dp"
        sothree:shadowHeight="3dp">

        <!-- MAIN CONTENT -->
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <android.support.v7.widget.Toolbar
                xmlns:sothree="http://schemas.android.com/apk/res-auto"
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/main_toolbar"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                sothree:theme="@style/MyApp.Widget.ActionBar.Solid"
                android:layout_width="match_parent"/>

            <fragment
                android:id="@+id/map"
                android:name="com.google.android.gms.maps.SupportMapFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.br.myapp.MapActivity" />
        </FrameLayout>



        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#99ffffff"
            android:clickable="false"
            android:focusable="false"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/linear_layout_anchor_area"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:orientation="vertical"
                android:padding="10dp">

                <TextView
                    android:id="@+id/text_park_name"
                    style="@style/MyApp.TextName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/placeholder_park_name"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/text_park_address"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/placeholder_park_address"
                    android:textAppearance="?android:attr/textAppearanceMedium" />

                <TextView
                    android:id="@+id/textParkAddressCaption"
                    style="@style/MyApp.Text.MoreInformation"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="right"
                    android:text="@string/label_more_information" …
Run Code Online (Sandbox Code Playgroud)

android android-5.0-lollipop

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

检测另一个应用程序是否正在运行

是否可以在 Android 上检测另一个应用程序是否正在运行?当地图应用程序(如 Waze 或 Google 地图)运行时,我需要在我的应用程序中触发某些操作。

android activity-monitor activity-manager

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

不能使用facebook python sdk

我正在尝试在新的appengine项目中使用来自http://github.com/pythonforfacebook的SDK ,但是dev-appserver说没有找到模块名称facebook.

这是代码:

import facebook
import webapp2
import os
import jinja2
import urllib2

from google.appengine.ext import db
from webapp2_extras import sessions


FACEBOOK_APP_ID = "xxxxx"
FACEBOOK_APP_SECRET = "xxxxx"

config = {}
config['webapp2_extras.sessions'] = dict(secret_key='')

class User(db.Model):
    id = db.StringProperty(required=True)
    created = db.DateTimeProperty(auto_now_add=True)
    updated = db.DateTimeProperty(auto_now=True)
    name = db.StringProperty(required=True)
    profile_url = db.StringProperty(required=True)
    access_token = db.StringProperty(required=True)


class BaseHandler(webapp2.RequestHandler):
    """Provides access to the active Facebook user in self.current_user
    The property is lazy-loaded on first access, using the cookie saved
    by the Facebook …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine facebook

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

让 AutoMapper 的 Map 忽略某些属性?

我的模型对象具有一些用于延迟加载集合的属性,而 AutoMapper 则可以在我不需要它们时加载这些集合(这导致我的数据库中执行数千次查询)。当我调用时,是否可以使 AutoMapper 忽略某些属性Mapper.Map

public TTarget Adapt<TSource, TTarget>(TSource source)
{
    return Mapper.Map<TTarget>(source);
}
Run Code Online (Sandbox Code Playgroud)

c# automapper

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

如何从 Angular 打开 input type="file" 对话框 - ng2FileUpload

我正在使用 ng2FileUpload 创建用于上传的拖放操作,但我也希望允许用户单击拖放区域以打开文件对话框。

考虑到我有这个输入:

<input type="file" ng2FileSelect [uploader]="uploader" style="display: none" />
Run Code Online (Sandbox Code Playgroud)

如何从 Angular 4 打字稿代码显示文件对话框?

typescript angular

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

插入或更新获取“事务查询已完成”

如何正确搜索数据库中的行和INSERT/UPDATE相应地搜索结果(INSERT如果未找到,UPDATE如果找到)?

我目前正在这样做:

bookshelf.transaction(async function (t) {
            for (var x = 0; x < 10; x++) {
                let row = pmsParser.getRow(x);
                if (_.isEmpty(row)) {
                    break;
                }

                let data = {
                    lastUpdate: moment(row.lastUpdate, 'DD/MM/YYYY - HH:mm').toDate(),
                    mvs: row.version,
                    color: row.color,
                    location: row.location,
                    status: row.status
                };

                new Vehicle({ chassi: row.chassi })
                    .fetch({ require: true })
                    .then(model => {

                        return new Vehicle(model)
                            .save(data, { transacting: t, patch: true });

                    })
                    .catch(Vehicle.NotFoundError, err => {
                        new Vehicle(data) …
Run Code Online (Sandbox Code Playgroud)

bookshelf.js

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

如何将Google Maps Android API v2标记链接到对象

我在地图中动态添加非固定数量的标记,每个标记都与我的POCO类的一个实例相关.

我需要链接它们,以便当用户点击其中一个标记时,我会在自定义InfoWindow中显示其余数据.

你有什么建议?

PS:我每次用户平移或缩放地图时添加新标记,我担心应用程序过载.是否放置了不可见的标记?

android google-maps-android-api-2

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

侧栏具有100%的高度和滚动内容区域

我正在使用Bootstrap Twitter并设计了一个带有固定导航栏和页脚的流畅布局.但是我仍然需要一个100%高度的固定左侧边栏和一个必要时滚动的内容区域.

我想使用浏览器的默认垂直滚动条,我的意思是,我不想在我的内容div中使用overflow-y.我在一些HTML5网站上看到了这一点,我也想这样做.

你能帮助我吗?

这是我正在使用的代码:http://jsfiddle.net/julianonunes/AhK3c/2/embedded/result/

<!-- Part 1: Wrap all page content here -->
<div id="wrap">
<!-- Fixed navbar -->
<div class="navbar navbar-fixed-top">
    <div class="navbar-inner"> <a class="brand" href="#">
                Texto</a>

        <ul class="nav pull-right">
            <li><a href="#">Dashboard</a>
            </li>
            <li class=""><a href="#">Link</a>
            </li>
        </ul>
    </div>
</div>
<!-- Begin page content -->
<div class="container-fluid no-padding header-margin">
    <div class="row-fluid">
        <div class="span2">
            <div class="well sidebar-nav">
                <ul class="nav nav-list">
                    <li class="nav-header">Sidebar</li>
                    <li class="active"><a href="#">Link</a>
                    </li>
                    <li><a href="#">Link</a>
                    </li>
                    <li><a href="#">Link</a>
                    </li>
                    <li><a href="#">Link</a>
                    </li>
                    <li …
Run Code Online (Sandbox Code Playgroud)

css html5 twitter-bootstrap

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

使用 REST 从其 url 获取列表 ID?

我正在使用 SharePoint 2013 REST API 来获取和创建列表项,但是我的解决方案的最终用户可能不知道如何找到列表 ID,只是其中一个视图的 URL,例如http://spsportal /Lists/MyCalendar/calendar.aspx

是否可以使用此 URL 找到列表 ID?

sharepoint-api sharepoint-2013

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

CQRS和域模型

我需要使用CQRS实现一个项目,但是我对哪些实体获得相应的命令和查询类有疑问.

如果我有A,B和C类,那么A是我的聚合根,其他是我的聚合中的子实体,哪些类应该有命令和查询类?

我的意思是,我应该有QueryA,QueryB和QueryC,还是应该只有QueryA,例如,它会使用延迟加载来带来子数据?

对于存储库,正如我对域模型的理解,我只考虑RepositoryA(对于我的聚合根).

domain-driven-design repository-pattern cqrs

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