10

それで、生成されたログイン画面(Eclipseから直接作成できるもの)を備えたAndroidアプリを手に入れました。それは働いています。問題は次のとおりです。ログイン画面をランチャー アクティビティに設定しました。これは機能します。残念ながら、App はログイン アクティビティの label パラメータとして呼び出されます。つまり、アプリケーションの android:label 値は単純に無視されます。

私の質問は非常に曖昧に聞こえるので、これが私のコードです:

    <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"  <!-- the app name i want it to have -->
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.test.testytest.MainActivity"
                android:configChanges="orientation"
                android:label="@string/app_name" >

            </activity>

<!-- some more activities -->

            <activity
                android:name="com.test.testytest.LoginActivity"
                android:label="@string/title_activity_login" <!-- the name the app is called in the drawer etc. -->
                android:windowSoftInputMode="adjustResize|stateVisible" >
                <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            </activity>
    </application>

文字列.xml:

<string name="app_name">Testy Test!</string>

string_activity_login:

    <string name="title_activity_login">Sign in</string>

Login アクティビティの文字列を app_name に変更すると、アプリの名前も変更されます。しかし、アプリは android:label で定義されているように呼び出す必要があると確信しています

あなたが私を助けてくれるか、私の間違いを指摘してくれることを願っています(多分私は少し詳細が欠けているだけです)。

少し編集:ログインアクティビティのラベルは「ログイン」のままにする必要があるため、変更したくありません。また、最初に呼び出されるアクティビティのままにする必要があります。ただし、ドロワーのアプリ名は で定義されたものである必要があります。

4

1 に答える 1

6

Geobits のおかげで:

アクティビティのタイトルではなく、ランチャーに別のラベルを設定する方法は次のとおりです。

解決策が見つかりました!

どうやら「intent-filter」はラベル属性を持つことができます。存在しない場合、ラベルは親コンポーネント (Activity または Application) から継承されます。これを使用すると、ランチャー アイコンのラベルを設定しながら、アクティビティに独自のタイトルを付けることができます。

http://developer.android.com/guide/topics/manifest/intent-filter-element.html

android:label="@string/title_home_activity"
android:icon="@drawable/icon">

于 2013-02-20T14:27:59.067 に答える