New Views/Controls themes: Theme.Holo and Theme.Light.Holo

Change-Id: Ie3cd1ea5713119ce2027096a55e68997127a46f7
This commit is contained in:
Gilles Debunne
2010-08-18 21:29:29 -07:00
parent 46a790eab0
commit 6e94ff6be9
7 changed files with 84 additions and 49 deletions

View File

@@ -1220,63 +1220,63 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List1" android:label="Views/Lists/1. Array"> <activity android:name=".view.List1" android:label="Views/Lists/01. Array">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List2" android:label="Views/Lists/2. Cursor (People)"> <activity android:name=".view.List2" android:label="Views/Lists/02. Cursor (People)">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List3" android:label="Views/Lists/3. Cursor (Phones)"> <activity android:name=".view.List3" android:label="Views/Lists/03. Cursor (Phones)">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List4" android:label="Views/Lists/4. ListAdapter"> <activity android:name=".view.List4" android:label="Views/Lists/04. ListAdapter">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List5" android:label="Views/Lists/5. Separators"> <activity android:name=".view.List5" android:label="Views/Lists/05. Separators">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List6" android:label="Views/Lists/6. ListAdapter Collapsed"> <activity android:name=".view.List6" android:label="Views/Lists/06. ListAdapter Collapsed">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List7" android:label="Views/Lists/7. Cursor (Phones)"> <activity android:name=".view.List7" android:label="Views/Lists/07. Cursor (Phones)">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List8" android:label="Views/Lists/8. Photos"> <activity android:name=".view.List8" android:label="Views/Lists/08. Photos">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.List9" android:label="Views/Lists/9. Array (Overlay)"> <activity android:name=".view.List9" android:label="Views/Lists/09. Array (Overlay)">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -1511,7 +1511,27 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".view.Controls2" android:label="Views/Controls/2. Default Theme"> <activity android:name=".view.Controls2"
android:label="Views/Controls/2. Default Theme"
android:theme="@android:style/Theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".view.Controls3"
android:label="Views/Controls/3. Holo Light Theme"
android:theme="@android:style/Theme.Light.Holo">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".view.Controls4"
android:label="Views/Controls/4. Holo Dark Theme"
android:theme="@android:style/Theme.Holo">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" /> <category android:name="android.intent.category.SAMPLE_CODE" />

View File

@@ -25,8 +25,8 @@ import android.app.FragmentTransaction;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;

View File

@@ -16,35 +16,4 @@
package com.example.android.apis.view; package com.example.android.apis.view;
// Need the following import to get access to the app resources, since this public class Controls2 extends Controls1 {}
// class is in a sub-package.
import com.example.android.apis.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Spinner;
import android.widget.ArrayAdapter;
/**
* A gallery of basic controls: Button, EditText, RadioButton, Checkbox,
* Spinner. This example uses the default theme.
*/
public class Controls2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.controls_1);
Spinner s1 = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, mStrings);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s1.setAdapter(adapter);
}
private static final String[] mStrings = {
"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"
};
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.apis.view;
public class Controls3 extends Controls1 {}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.apis.view;
public class Controls4 extends Controls1 {}

View File

@@ -44,7 +44,7 @@ public class Tabs3 extends TabActivity {
// the tab is clicked. // the tab is clicked.
tabHost.addTab(tabHost.newTabSpec("tab3") tabHost.addTab(tabHost.newTabSpec("tab3")
.setIndicator("destroy") .setIndicator("destroy")
.setContent(new Intent(this, Controls2.class) .setContent(new Intent(this, Controls1.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))); .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
} }
} }

View File

@@ -235,13 +235,21 @@
<h3>Controls</h3> <h3>Controls</h3>
<dl> <dl>
<dt><a href="Controls1.html">1. Theme White</a></dt> <dt><a href="Controls1.html">1. Theme Light</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the white theme. </dd> <dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the light theme. </dd>
</dl> </dl>
<dl> <dl>
<dt><a href="Controls2.html">2. Theme Dark</a></dt> <dt><a href="Controls1.html">2. Theme Dark</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark theme. </dd> <dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark theme. </dd>
</dl> </dl>
<dl>
<dt><a href="Controls1.html">3. Theme Holographic Light</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the light holographic theme. </dd>
</dl>
<dl>
<dt><a href="Controls1.html">4. Theme Holographic Dark</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark holographic theme. </dd>
</dl>
<h3>Auto Complete</h3> <h3>Auto Complete</h3>
<dl> <dl>