1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
19import android.app.Activity;
20import android.os.Bundle;
21import android.widget.LinearLayout;
22import android.widget.Button;
23import com.android.frameworks.coretests.R;
24
25public class MutateDrawable extends Activity {
26    @Override
27    protected void onCreate(Bundle savedInstanceState) {
28        super.onCreate(savedInstanceState);
29
30        LinearLayout layout = new LinearLayout(this);
31
32        Button ok = new Button(this);
33        ok.setId(R.id.a);
34        ok.setBackgroundDrawable(getResources().getDrawable(
35                R.drawable.sym_now_playing_skip_forward_1));
36
37        Button cancel = new Button(this);
38        cancel.setId(R.id.b);
39        cancel.setBackgroundDrawable(getResources().getDrawable(
40                R.drawable.sym_now_playing_skip_forward_1));
41
42        layout.addView(ok);
43        layout.addView(cancel);
44
45        ok.getBackground().mutate().setAlpha(127);
46
47        setContentView(layout);
48    }
49}
50