私はAndroidの新しいものです。
アプリケーションを実行すると、次のエラーが表示されます。
"AAPT: エラー: 属性 depensOn が見つかりません"
"AAPT: エラー: 属性 tagetAlpha が見つかりません".
依存動作または単純なサイト、 Simple View Behavior for Android Coordinatorlayoutを使用しようとしています。
最初に説明したように依存関係を追加します。これが私の Gradle 依存関係ファイルです。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//LIBRERIA PARA BOTTOM BAR
implementation 'com.roughike:bottom-bar:2.3.1'
//LIBRERIA PARA IMAGEN REDONDA
implementation 'de.hdodenhof:circleimageview:3.0.1'
//LIBRERIA PARA IMAGEN DE INTERNET
implementation 'com.squareup.picasso:picasso:2.5.2'
//LIBRERIA COMPORTAMIENTO DEPENDIENTE
implementation 'com.zoonref:simple-view-behavior:1.0' }
この動作の使用に応じて、xml オプションのみを使用して効果を構成できます。
- レイアウト動作をこのライブラリ クラスapp:layout_behavior="com.zoonref.SimpleViewBehavior"に設定します。( Circleimageview と Textview で行っていることと同じです。 )
- app:dependsOn="@+id/{your view id}"でリソース ID を指定して、依存ビューを設定します。
- 依存関係 app:dependType="{x,y,width,height}"のタイプを設定します。
- 選択したタイプapp:dependTargetXXX="{value}"に従って依存関係ビューのターゲット値を設定します。
- 最後に、ビューをアニメーション化するターゲットの外観を設定します。
まさに私がしていること。
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="@dimen/dimen_circleimageprofile"
android:layout_height="@dimen/dimen_circleimageprofile"
android:src="@drawable/image2"
android:layout_gravity="center|top"
android:layout_marginTop="@dimen/margintop_circleimageprofile"
android:elevation="@dimen/elevation_circleimageprofile"
app:layout_behavior="com.zoonref.SimpleViewBehavior"
app:depensOn="@+id/appBarProfile"
app:dependType="y"
app:dependTargetY="@dimen/limitY_circleimage"
app:targetX="@dimen/activity_vertical_margin"
app:targetY="@dimen/margintoptoolbar_circleimageprofile"
app:targetWidth="@dimen/width_circleimagetoolbar"
app:targetHeight="@dimen/width_circleimagetoolbar" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/usernameToolbarProfile"
android:layout_width="wrap_content"
android:layout_height="281dp"
android:layout_marginLeft="@dimen/marginleft_usernametoolbarprofile"
android:layout_marginTop="@dimen/margintop_usernametoolbarprofile"
android:alpha="0"
android:elevation="@dimen/elevation_circleimageprofile"
android:gravity="center_vertical"
android:text="@string/username_card"
android:textColor="@android:color/white"
android:textSize="@dimen/textsize_usernametoolbarprofile"
app:layout_behavior="com.zoonref.SimpleViewBehavior"
app:depensOn="@+id/appBarProfile"
app:dependType="y"
app:dependTargetY="@dimen/limitY_appcompattext_usernametoolbarprofile"
app:targetY="@dimen/margintoptargety_appcompattext_usernametoolbarprofile"
app:tagetAlpha="1" />
しかし、プログラムを実行すると、次のエラーが発生します。
ビルドが例外で失敗しました。問題: タスク ':app:processDebugResources' の実行に失敗しました。com.android.build.gradle.internal.tasks.Workers$ActionFacade の実行中にエラーが発生しました Android リソースのリンクに失敗しました C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:71 : AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 tagetAlpha (別名 platzi.com:tagetAlpha) が見つかりません。processDebugResources'. com.android.build.gradle.internal.tasks.Workers$ActionFacade の実行中にエラーが発生しました Android リソースのリンクに失敗しました C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:71 : AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 tagetAlpha (別名 platzi.com:tagetAlpha) が見つかりません。processDebugResources'. com.android.build.gradle.internal.tasks.Workers$ActionFacade の実行中にエラーが発生しました Android リソースのリンクに失敗しました C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:71 : AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 tagetAlpha (別名 platzi.com:tagetAlpha) が見つかりません。\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:71: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 tagetAlpha (別名 platzi.com:tagetAlpha) が見つかりません。\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:71: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 depensOn (別名 platzi.com:depensOn) が見つかりません。C:\Users\sebas\AndroidStudioProjects\PlatzigramSena\app\src\main\res\layout\fragment_profile.xml:102: AAPT: エラー: 属性 tagetAlpha (別名 platzi.com:tagetAlpha) が見つかりません。
これはすべて私のxmlファイルです:
<androidx.coordinatorlayout.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"
tools:context="view.fragment.ProfileFragment"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:background="@color/colorPrimary">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:statusBarScrim="@color/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="200dp"
android:paddingBottom="20dp"
android:layout_gravity="center|top"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center">
<TextView
android:id="@+id/usernameProfile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/username_card"
android:textColor="@android:color/white"
android:textSize="@dimen/textsize_usernameprofile"/>
</LinearLayout>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pictureProfileRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<!-- IMAGEN EN CIRCULO, LIBRERIA EN GRADLE -->
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="@dimen/dimen_circleimageprofile"
android:layout_height="@dimen/dimen_circleimageprofile"
android:src="@drawable/image2"
android:layout_gravity="center|top"
android:layout_marginTop="@dimen/margintop_circleimageprofile"
android:elevation="@dimen/elevation_circleimageprofile"
app:layout_behavior="com.zoonref.SimpleViewBehavior"
app:depensOn="@+id/appBarProfile"
app:dependType="y"
app:dependTargetY="@dimen/limitY_circleimage"
app:targetX="@dimen/activity_vertical_margin"
app:targetY="@dimen/margintoptoolbar_circleimageprofile"
app:targetWidth="@dimen/width_circleimagetoolbar"
app:targetHeight="@dimen/width_circleimagetoolbar" />
<!-- android:elevation TENDRA QUE EVR CON LA ANIMACION QUE VAYA TENER LA IMAGEN-->
<!-- app:layout_behavior EL COMPORTAMIENTO QUE QUEREMOS DARLE-->
<!--
pp:depensOn="@+id/appBarProfile" -> ESTA IMAGEN ESTA DEPENDIENDO DE "@+id/appBarProfile"
app:dependType="y" -> TYPO DE DEPENDENCIA, EN QUE SENTIDO VA TENER DEPENDENCIA
app:dependTargetY="-256dp" -> LIMITE HASTA DODNE QUEREMOS QUE SE MUEVA LA IMAGEN, QUE SUBA LA IMAGEN
app:targetX="16dp" -> UNA VEZ QUE LA IMAGEN SE POSICIONO, CUANDO MARGEN QUEREMOS DEJAR
app:targetY="-16dp" -> CUANTO QUEREMOS QUE SUBA
app:targetWidth="40dp" -> DE QUE DIMENSION VA QUEDAR LA IMAGEN
-->
<!-- TextView QUE DEPENDE DE LA IMAGEN, QUEDA AL LADO DE LA IMAGEN -->
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/usernameToolbarProfile"
android:layout_width="wrap_content"
android:layout_height="281dp"
android:layout_marginLeft="@dimen/marginleft_usernametoolbarprofile"
android:layout_marginTop="@dimen/margintop_usernametoolbarprofile"
android:alpha="0"
android:elevation="@dimen/elevation_circleimageprofile"
android:gravity="center_vertical"
android:text="@string/username_card"
android:textColor="@android:color/white"
android:textSize="@dimen/textsize_usernametoolbarprofile"
app:layout_behavior="com.zoonref.SimpleViewBehavior"
app:depensOn="@+id/appBarProfile"
app:dependType="y"
app:dependTargetY="@dimen/limitY_appcompattext_usernametoolbarprofile"
app:targetY="@dimen/margintoptargety_appcompattext_usernametoolbarprofile"
app:tagetAlpha="1" /><!--CANTIDAD DE TRANSPARENCIA QUE QUEREMOS EN NUETSROS ELEMENTOS-->
どんな助けでも大歓迎です。