小编dba*_*bar的帖子

Android键盘与表情符号

所以我希望在我的应用程序中有一个键盘,它有表情符号,就像Whatsapp或Hangouts一样.我怎样才能做到这一点?我想离开我的键盘,因为它只是想添加标签以放置表情符号.我认为软键盘很容易支持,但到目前为止我什么都找不到.谁能说出怎么做?

更新:带有表情符号的键盘包含在Android KitKat中,可以通过长按键盘上的新线路按钮进行访问.然而,环聊键盘可以看到表情符号图标,而不是"新行"键.如果有人知道如何将其设置为默认值(无论是布局还是编程),我会将其作为正确的答案.

android android-softkeyboard emoji

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

Android折叠工具栏不使用像Google Play App这样的惯性

我正在使用Android设计支持库创建一个带有可折叠工具栏的活动,其效果很好,就像Google Play或Whatsapp的联系人个人资料一样.我将活动布局放在最后但请记住,这只是默认的可折叠活动布局,我将ImageView添加到AppBarLayout以创建工具栏< - >图像淡入淡出效果.

我对这个实现的问题表现为我将描述的两个症状:

  • 活动内容很长,当我想快速向上滚动时,滚动将在展开工具栏之前停止.我希望它继续,当我在我的NestedScrollView的底部,我做一个快速的手指滑动,一直到我的活动的顶部我希望这个滚动去扩展工具栏,这是方式谷歌Play应用程序表现或Whatsapp的个人资料.

  • 类似地,当工具栏展开时,滚动没有惯性,快速向下滑动会滚动一点点,这也不是Google Play或Whatsapp配置文件的行为方式.折叠工具栏后,滚动的行为与ScrollViews,ListViews等中的滚动一样.快速滑动将允许您进入底部或顶部(除非有大量内容).

我描述的行为是否由设计支持库支持?

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=".ScrollingActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:fitsSystemWindows="true"
        android:layout_height="@dimen/app_bar_height_custom"
        android:layout_width="match_parent"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:fitsSystemWindows="true"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimary">

            <ImageView
                android:src="@drawable/cuthbert"
                app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax"
                android:minHeight="100dp"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                app:layout_collapseMode="parallax"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/AppTheme.PopupOverlay" />
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_scrolling"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|end"
        android:src="@android:drawable/ic_dialog_email"/>

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

content_scrolling.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/activity_scrolling"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ScrollingActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/text_margin" …
Run Code Online (Sandbox Code Playgroud)

android android-collapsingtoolbarlayout android-appbarlayout

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

Spring WebFlux 功能端点 + @JsonView 怎么样?

我正在使用 Spring Boot 2.0.4 WebFlux 和功能端点。

我想在 GET /books 和 GET /books/{id} 中返回不同的模型。前者是简短模型,后者是完整模型。

我可以使用 @JsonIgnore 从 JSON 序列化中过滤出属性,但这会从使用此模型的所有响应中删除任何特定字段。

Jackson 提供了 @JsonView 作为解决方案,但该解决方案仅与带注释的控制器兼容,我正在使用如下功能端点:

@Configuration
public class BookRouter {

    @Bean
    public RouterFunction<ServerResponse> routeBooks(BookHandler bookHandler) {
        return RouterFunctions
            .route(RequestPredicates.GET("/books")
                    .and(RequestPredicates.accept(MediaType.APPLICATION_JSON)), bookHandler::getBooks)
            .andRoute(RequestPredicates.GET("/books/{id}")
                    .and(RequestPredicates.accept(MediaType.APPLICATION_JSON)), bookHandler::getBook);
    }
}
Run Code Online (Sandbox Code Playgroud)

所以基本上我问是否有任何已知的方法可以将 @JsonView 与功能端点一起使用,或者是否有任何其他方法可以实现我想做的事情。

spring json hibernate jackson spring-webflux

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