小编phr*_*ead的帖子

缺少多模块项目中的顶级build.gradle

我错过了项目中的"顶级"项目build.gradle脚本:

在此输入图像描述

我从一个非常复杂的Maven/Eclipse项目将它导入Android Studio,它基本上在目录的顶层创建了一个模块("android"),并添加了所有子模块("tappurwear","shared"等)进入原始模块的目录.

我知道这是一种混乱的结构,但是还有很多其他构建脚本,所以我不能真正将所有文件移动到一个合适的单独模块中.

所以现在我想知道,如何为整个项目添加顶级build.gradle脚本?我见过的常见Android Studio项目只有一个,但它将我的顶级构建脚本视为"android"模块的构建脚本.我可以创建一个新的build.script作为与其他模块共享设置的顶级项目脚本吗?有没有办法可以重命名在Android Studio或Gradle中用于所有其他模块脚本的顶级构建脚本?

android gradle android-studio

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

Invalidate()实际上不会重绘子项

所以,我有一个非常奇怪的设置,我得到了一些奇怪的视觉错误.基本上,我在相对布局中有两个视图:第一个是ImageView背景图像; 第二个是相同的背景图像,但模糊,以提供一种背后磨砂玻璃效果:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/profile_holder"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- background -->
    <ImageView
        android:id="@+id/backgroundImage"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="0dp"
        android:layout_marginTop="0dp"
        android:scaleType="centerCrop"
        android:src="@drawable/default_logo" />

    <!-- blurry background -->
    <com.custom.MaskedBlurredBackgroundView_
        android:id="@+id/blurred_background"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="0dp"
        android:layout_marginTop="0dp" />

<ScrollView
    android:id="@+id/scrolly"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" >

            <com.custom.HalvedLinearLayout_
                android:paddingTop="100dp"
                android:id="@+id/profileHolder"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                 >

                <Button
                    android:id="@+id/profileButtonTracks"
                    style="@style/ProfileButtons"
                    android:drawableLeft="@drawable/ic_profile_menu_music"
                    android:text="@string/profile_button_tracks" />

...
Run Code Online (Sandbox Code Playgroud)

模糊的背景应仅位于向上滚动的HalvedLinearLayout_视图后面,因此我需要模糊的背景将自己屏蔽在HalvedLinearLayout_上方,以便非模糊背景显示:

scrolly  = ((ScrollView) rootView.findViewById(R.id.scrolly));
scrolly.setOnScrollListener(new ScrollView.OnScrollListener() {

    private boolean hasScrolled = false;

    @Override
    public void onScrollChanged(int l, int t, int oldl, …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-view

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

点按以在CameraX中调整焦点/曝光

我想实现标准的UX,即在预览中点击一个点,以将自动聚焦和自动曝光点调整到它们所点击的位置。我找到了Preview.focus()函数,但是它说它需要“传感器坐标系”中的尺寸,我认为这与TextureView的TouchEvent像素坐标不同。

如何从TextureView预览的触摸坐标转换为Preview.focus()期望的“传感器坐标框架”?

如果此示例是示例代码的一部分,那就太好了,因为这似乎是几乎每个人都会期望的非常普遍的用例。

android android-camerax

5
推荐指数
2
解决办法
568
查看次数