小编Ram*_*ski的帖子

无法解析AppCompatActivity

重命名应用程序包名称后,Android Studio显示此错误 can't resolve symbol AppCompatActivity

我试过的事情:

  • 清洁项目
  • 清理Android Studio缓存
  • 清理Gradle缓存
  • 重新安装IDE
  • 文件 - >无效缓存/重启

但没有什么真正帮助.项目构建成功,但我不能使用语法高亮.

我用了 com.android.support:appcompat-v7:23.1.1

截图

BaseActivity

构建gradle文件

android android-appcompat android-studio appcompatactivity

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

Android.Share到社交网络

我正在寻找一种方式,如何使用android共享意图分享一个文本到社交网络.几乎每个人都提供此代码

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, sometext);
startActivity(Intent.createChooser(shareIntent, "Share using"));
Run Code Online (Sandbox Code Playgroud)

但它不适用于Facebook.有没有办法与所有网络共享文本.谢谢.

android share social-networking android-intent

6
推荐指数
2
解决办法
2666
查看次数

android设计库工具栏阴影

尝试新的Android设计库我发现了工具栏阴影的错误.使用CollapsingToolbarLayout时,仅当工具栏折叠时,工具栏下方的阴影才会出现.当我们展开它时,阴影消失了.我的布局看起来像

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

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    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="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="@dimen/user_avatar_height"
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop"
            app:layout_collapseMode="parallax" />

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

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

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@color/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        app:tabGravity="fill"
        app:tabIndicatorColor="@android:color/white"
        app:tabMaxWidth="0dp"
        app:tabMode="fixed" />

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

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

结果 在此输入图像描述 工具栏折叠时有阴影.

在此输入图像描述

但是当它扩大时它的阴影消失了.

有什么解决方案可以解决这个问题吗?可能有办法处理阴影出现/消失?谢谢.

android toolbar shadow

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

在嵌套滚动视图中使用水平回收器视图时,折叠的工具栏布局不起作用

我在折叠工具栏上遇到了一些问题。我有以下布局结构

<CoordinatorLayout>
    <AppbarLayout>
        <CollapsingToolbar>
    <NestedScrollView>
        <HorizontalRecyclerView>
    </NestedScrollView>
</CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

仅当我尝试滚动NestedScrollView触摸时才会出现问题HorizontalRecyclerView。在那种情况下CollapsingToolbar不会崩溃。只需AppbarLayout停留在该位置并NestedScrollView在其下方滚动即可。我已附上一个视频,其中的所有内容都很清晰。谁能解释这个问题?谢谢。

android-recyclerview coordinator-layout android-collapsingtoolbarlayout android-appbarlayout

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

android选项卡布局设计库

我在新的android.support.design.widget包中使用TabLayout.

<android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabGravity="fill"
        app:tabIndicatorColor="@android:color/white"
        app:tabMode="fixed" />
Run Code Online (Sandbox Code Playgroud)

但在平板电脑上他们看起来像

在此输入图像描述

如何拉伸它们以填满整个宽度.谢谢.

tabs android

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