2017-10-30 9 views
-2

Androidスタジオ2.3からAndroidスタジオ3.0へのアップグレードでは、このファイルをsimple.xml.ftlで編集して、RelativeLayoutではなくConstraintLayoutを使用しました。下記の2つのftlファイルフォーマット。私の質問はなぜこれが起こっているのですか?私はエラーログを見て、ftl構文を学ぶことを望んでいません。誰かがこのファイルにAndroid Studio 2.3.3または3.0を持つコードをコピーして回答として投稿しますか?このファイルへのパスは「AndroidStudio/plugins/android/lib/templates/activities/common/root/res/layout /simple.xml.ftl」 ファイルをメモ帳または崇高なテキストで開き、内容をコピーします。アンドロイドスタジオ3.0がアクティビティを作成できません

これは私の元のファイルがここ

<?xml version="1.0" encoding="utf-8"?> 
    <android.support.constraint.ConstraintLayout 
    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" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    <#if hasAppBar && appBarLayoutName??> 
    tools:showIn="@layout/${appBarLayoutName}" 
    </#if> 
    tools:context="${relativePackage}.${fragmentClass}"> 

    <#if isNewProject!false> 
    <TextView 
    <#if includeCppSupport!false> 
    android:id="@+id/sample_text" 
    </#if> 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Hello World!" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" /> 
    </#if> 

    </android.support.constraint.ConstraintLayout> 

    This is my change that worked until Android Studio 3.0 

    <?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout 
    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" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    <#if hasAppBar && appBarLayoutName??> 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/${appBarLayoutName}" 
    </#if> 


    tools:context="${relativePackage}.${activityClpackageNamsNewProject!false> 
    <TextView 
    <#if includeCppSupport!false> 
    android:id="@+id/sample_text" 
    </#if> 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Hello World!" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" /> 

    </#if> 
    </RelativeLayout> 
+0

ファインを働く場合はお知らせ私の結果として質問を投票しました。失敗した人が退屈な人ではありませんでした。私はいくつかの研究をしたと言わなければならないという事実を私が知っているという事実を処理した数多くのSOの投稿を見てきました –

+0

@ddekanyエラーはこの質問の正しいFTL構文を提案するか、simple.xml.ftを共有できますか私はコードを書くことに戻ることができます –

答えて

1

のように見えたものですが、私は相対的なレイアウトに変更と私のファイルを投稿しますあなたの相対的なレイアウトsimple.xml.ftlファイル内の故障は、それが動作している素晴らしい最初に私意志マイコード一つBIG提案は崇高なテキストからSAVE ASを行うと、ファイルを開けないでくださいファイルを置き換えると方法だけで他のNetBeansとの過去の経験から

あなたのコード

ファイルのコードを保存しようと、あなたのコードを投稿
tools:context="${relativePackage}.${activityClpackageNamsNewProject!false> 

マイコードここ

tools:context="${packageName}.${activityClass}"> 

ある完全なコード、それは私がすべて失敗を正しい構文を構築するためにFTLファイルに多数の編集をしようとしたダウン質問を投票する

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
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" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
<#if hasAppBar && appBarLayoutName??> 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:showIn="@layout/${appBarLayoutName}" 
</#if> 
tools:context="${packageName}.${activityClass}"> 

<#if isNewProject!false> 
<TextView 
<#if includeCppSupport!false> 
    android:id="@+id/sample_text" 
</#if> 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Hello World!" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" /> 

</#if> 
</RelativeLayout> 
+0

私は結果のない元とは違って投稿したそのコード行を試しました私は提案されたファイルを保存します私はあなたに感謝していただきありがとうございますこれをBUGにしましたAndroid Studio 3.0はきちんとしていますが、安定していないはずです –

関連する問題