Update ApiDemos control samples for Material
Adds examples for a variety of Material-only control styles including underlined Spinner and discrete SeekBar. Groups controls into cards. For the old-style controls, moves some run-time setup tasks into XML. Bug: 19352193 Change-Id: Ibb1c82ac6ecaca3b93f3acfd65ef67cd9784fef4
This commit is contained in:
@@ -36,19 +36,7 @@ public class Controls1 extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.controls_1);
|
||||
|
||||
Button disabledButton = (Button) findViewById(R.id.button_disabled);
|
||||
disabledButton.setEnabled(false);
|
||||
|
||||
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"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
* Copyright (C) 2016 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.
|
||||
@@ -16,4 +16,4 @@
|
||||
|
||||
package com.example.android.apis.view;
|
||||
|
||||
public class Controls5 extends Controls1 {}
|
||||
public class ControlsMaterialDark extends ControlsMaterialLight { }
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
* Copyright (C) 2016 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.
|
||||
@@ -16,4 +16,15 @@
|
||||
|
||||
package com.example.android.apis.view;
|
||||
|
||||
public class Controls6 extends Controls1 {}
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ControlsMaterialLight extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(com.example.android.apis.R.layout.controls_material);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user