标签: android-design-library

我可以使用Android官方库使用Android浮动操作按钮吗?

不是其他图书馆,

我想像v7一样使用'Android官方库',支持库其他任何东西.

我有一个NEXUS7,我想使用Listview的浮动操作按钮.

那么......我怎样才能使用浮动动作按钮?

android android-library floating-action-button android-design-library

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

layout_scrollFlags不适用于CollapsingToolbarLayout之外的视图

我想滚动用户说明,但layout_scrollFlags ="滚动"不适用于RelativeLayout.ViewPager有2个片段,里面有SwipeRefreshLayout和RecyclerView.如何在CollapsingToolbar exitUntilCollapsed时滚出描述?

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

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

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

        <ImageView
            android:id="@+id/user_background"
            android:layout_width="match_parent"
            android:layout_height="192dp"
            android:fitsSystemWindows="true"
            app:layout_collapseMode="parallax" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_marginBottom="@dimen/keyline_1">

            <ImageView
                android:id="@+id/avatar"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_marginLeft="@dimen/keyline_1"
                android:layout_marginStart="@dimen/keyline_1" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/keyline_1"
                android:layout_marginStart="@dimen/keyline_1"
                android:layout_toEndOf="@id/avatar"
                android:layout_toRightOf="@id/avatar"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/full_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="@style/TextAppearance.AppCompat.Body2" />

                <TextView
                    android:id="@+id/screen_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

            </LinearLayout>

        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

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

    <RelativeLayout
        android:id="@+id/information"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll">

        <TextView
            android:id="@+id/bio"
            android:layout_width="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android-design-library androiddesignsupport android-collapsingtoolbarlayout android-appbarlayout android-tablayout

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

Android BottomSheetBehavior setState()NullPointerException

我正在尝试BottomSheetBehavior从Android支持设计库中实现.我初始化BottomSheetBehavior如下:

private void initBottomSheet() {
        new AsyncTask<Void, Void, Void>() {

            View bottomSheetFrame = rootView.findViewById(R.id.bottom_sheet);

            }

            @Override
            protected Void doInBackground(Void... params) {
                bottomSheetBehavior = BottomSheetBehavior.from(bottomSheetFrame);

                bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
                    private boolean isOnTop = false;

                    @Override
                    public void onStateChanged(@NonNull View bottomSheet, int newState) {
                        switch (newState) {

                            case BottomSheetBehavior.STATE_DRAGGING: {
                                ...
                            }

                            case BottomSheetBehavior.STATE_SETTLING: {
                                ...
                            }

                            case BottomSheetBehavior.STATE_EXPANDED: {
                               ...
                            }

                            case BottomSheetBehavior.STATE_COLLAPSED: {
                                ...
                            }

                            case BottomSheetBehavior.STATE_HIDDEN: {
                                ...
                            }

                            default: {
                                break;
                            }
                        }
                    }

                    @Override …
Run Code Online (Sandbox Code Playgroud)

java android nullpointerexception android-support-library android-design-library

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

如何实现Android入门快速入门?

我希望为我的应用程序的浮动操作按钮实现这种类型的入门指南。是否有预定义的模板或示例代码来解释如何实现此功能?我找不到任何代码示例,只有 Material Design Do/Don’t Do...

编辑:这是入门指南的图片。

浮动操作按钮入职指南

android material-design android-design-library

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

无法膨胀行为子类 android.support.design.widget.scroll_behavior

这是我使用坐标布局和查看寻呼机的活动。

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

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

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

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_gravity="bottom"
            app:tabIndicatorColor="@android:color/white"
            app:tabMode="scrollable"
            app:tabSelectedTextColor="@color/white"
            app:tabTextColor="@color/white50" />

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

<android.support.v4.view.ViewPager
    android:id="@+id/view_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />
Run Code Online (Sandbox Code Playgroud)

运行应用程序时,它会崩溃并显示以下消息:引起:java.lang.RuntimeException:无法膨胀行为子类 android.support.design.widget.scroll_behavior

android android-design-library

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

Android:如何使用支持25.0.0的Espresso 2.2.2?

我怎样才能使这个工作?我读了很多类似的策略,唉.使用高于23.1.1的支持库会一次又一次失败.

dependencies {
  compile 'com.android.support:design:25.0.0'
  compile 'com.android.support:support-v4:25.0.0'
  compile files('libs/slf4j-android-1.5.8.jar')
  androidTestCompile 'com.android.support:support-annotations:25.0.0'
  androidTestCompile( 'com.android.support.test:rules:0.5')
  androidTestCompile( 'com.android.support.test.espresso:espresso-contrib:2.2.2')
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
 })
}
Run Code Online (Sandbox Code Playgroud)

我收到了这条消息:

警告:与依赖项'com.android.support:recyclerview-v7'冲突.app(25.0.0)和测试app(23.1.1)的已解决版本有所不同.有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict.警告:与依赖项'com.android.support:support-v4'冲突.app(25.0.0)和测试app(23.1.1)的已解决版本有所不同.有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict.警告:与依赖项'com.android.support:appcompat-v7'冲突.app(25.0.0)和测试app(23.1.1)的已解决版本有所不同.有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict.警告:与依赖项"com.android.support:design"冲突.app(25.0.0)和测试app(23.1.1)的已解决版本有所不同.有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict.

第1步:我尝试使用排除组...没有用.

第2步:我也尝试了不同的策略,例如:configurations.all {resolutionStrategy {force'com.android.support:support-annotations:23.1.1'}}

第3步:当然我尝试了第一个gradlew:app:dependenices等,但是那个一直在崩溃.是的,我使用的是JDK1.8.这是一个注册的bug,自夏天以来一直没有解决.

顺便说一句...... Android,支持包和Espresso都来自谷歌?

android dependency-management gradle android-espresso android-design-library

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

@ string / appbar_scrolling_view_behavior在com.android.support:design中被标记为私有

我已经将支持库更新为28.0.0-alpha3,@string/appbar_scrolling_view_behavior is marked as private in com.android.support:design当我在具有协调器布局的布局中使用它时,lint会向我发出此警告。现在使用此行为的正确方法是什么?

android android-support-library android-design-library android-coordinatorlayout

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

实现滚动感知FloatingActionButton的推荐方法

我正在构建一个关于Material Design的应用程序,我想知道如何在滚动时隐藏FAB.谷歌搜索导致几个答案,有些人说提供自定义onScrollListeners等,有些人说实现布局行为.是否有标准/推荐的方法来做到这一点?一种方法比另一种方法有什么优势?

android android-support-library material-design floating-action-button android-design-library

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

从自定义URL加载导航抽屉标题中的图像

我没有使用任何自定义库来制作导航视图.我正在使用支持设计库中的导航视图.如何使用Glide或Fresco将Header图像设置为来自Internet的自定义图像.目前我有一个静态ImageView作为抽屉标题.

编辑 - 图像需要大小?

android android-glide android-design-library

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

更改EditText的图标颜色为焦点

在材料设计准则中,我们可以找到以下内容: 在此处输入图片说明 一个带有图标的EditText,该图标可更改焦点上的颜色。

内置的设计支持库24.2.0是否可以实现此行为?是否有一个无缝的属性可以完成它,就像这些app:passwordToggle属性一样?

请注意,使用EditText的drawableStartdrawableLeft属性将使图标显示在EditText的底行

在此处输入图片说明

而不是在材料设计准则中所展示的范围之外(参见:第一张图片)

android material-design android-design-library

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