blob: 74daccce3726519202428022eae7a306d9941b7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
package com.android.test.layout;
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridLayout;
import android.widget.Space;
import android.widget.TextView;
import static android.text.InputType.TYPE_CLASS_TEXT;
import static android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
import static android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
import static android.widget.GridLayout.*;
import static android.widget.GridLayout.FILL;
import static android.widget.GridLayout.spec;
public class LayoutInsetsTest extends Activity {
public static View create(Context context) {
GridLayout p = new GridLayout(context);
p.setUseDefaultMargins(true);
p.setAlignmentMode(ALIGN_BOUNDS);
p.setOrientation(VERTICAL);
{
TextView c = new TextView(context);
c.setTextSize(32);
c.setText("Email setup");
p.addView(c);
}
{
Button c = new Button(context);
c.setBackgroundResource(R.drawable.btn_default);
c.setText("Manual setup");
p.addView(c);
c.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Button b = (Button) v;
b.setEnabled(false);
}
});
}
return p;
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//getApplicationInfo().targetSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH;
getApplicationInfo().targetSdkVersion = Build.VERSION_CODES.JELLY_BEAN;
setContentView(create(this));
}
}
|