use of android.widget.LinearLayout in project dynamic-load-apk by singwhatiwanna.
the class MainActivity method generateContentView.
private View generateContentView(final Context context) {
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
layout.setBackgroundColor(Color.parseColor("#F79AB5"));
Button button = new Button(context);
button.setText("Start TestActivity");
layout.addView(button, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
DLIntent intent = new DLIntent(getPackageName(), TestFragmentActivity.class);
// 传递Parcelable类型的数据
intent.putExtra("person", new Person("plugin-a", 22));
intent.putExtra("dl_extra", "from DL framework");
startPluginActivityForResult(intent, 0);
}
});
Button button2 = new Button(context);
button2.setText("Start Service");
layout.addView(button2, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
button2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
DLIntent intent = new DLIntent(getPackageName(), TestService.class);
startPluginService(intent);
}
});
Button button3 = new Button(context);
button3.setText("bind Service");
layout.addView(button3, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
button3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mConnecton == null) {
mConnecton = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {
}
public void onServiceConnected(ComponentName name, IBinder binder) {
int sum = ((ITestServiceInterface) binder).sum(5, 5);
Log.e("MainActivity", "onServiceConnected sum(5 + 5) = " + sum);
}
};
}
DLIntent intent = new DLIntent(getPackageName(), TestService.class);
bindPluginService(intent, mConnecton, Context.BIND_AUTO_CREATE);
}
});
Button button4 = new Button(context);
button4.setText("unbind Service");
layout.addView(button4, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
button4.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (mConnecton != null) {
DLIntent intent = new DLIntent(getPackageName(), TestService.class);
unBindPluginService(intent, mConnecton);
mConnecton = null;
}
}
});
return layout;
}
use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class ManyEditTextActivityScrollResize method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRootView = new ScrollView(this);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
for (int i = 0; i < NUM_EDIT_TEXTS; i++) {
final EditText editText = new EditText(this);
editText.setText(String.valueOf(i));
editText.setId(i);
layout.addView(editText);
}
((ScrollView) mRootView).addView(layout);
setContentView(mRootView);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class OneEditTextActivitySelected method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
mRootView = new ScrollView(this);
EditText editText = new EditText(this);
editText.requestFocus();
mDefaultFocusedView = editText;
layout.addView(editText);
((ScrollView) mRootView).addView(layout);
setContentView(mRootView);
// set to resize so IME is always shown (and also so
// ImfBaseTestCase#destructiveCheckImeInitialState thinks it should always be shown
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class TransformTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setTitle(R.string.act_title);
LinearLayout root = new LinearLayout(this);
root.setOrientation(LinearLayout.VERTICAL);
TransformView view = new TransformView(getApplicationContext());
Drawable drawable = getResources().getDrawable(R.drawable.logo);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicWidth());
view.setDrawable(drawable);
root.addView(view);
setContentView(root);
}
use of android.widget.LinearLayout in project platform_frameworks_base by android.
the class SurfaceCompositionMeasuringActivity method createButton.
private Button createButton(String caption, LinearLayout layout) {
Button button = new Button(this);
button.setText(caption);
button.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
button.setOnClickListener(this);
layout.addView(button);
return button;
}
Aggregations