Search in sources :

Example 71 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class MarqueeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    final TextView text1 = new TextView(this);
    text1.setText("This is a marquee inside a TextView");
    text1.setSingleLine(true);
    text1.setHorizontalFadingEdgeEnabled(true);
    text1.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    linearLayout.addView(text1, new LinearLayout.LayoutParams(100, LinearLayout.LayoutParams.WRAP_CONTENT));
    final TextView text2 = new TextView(this);
    text2.setText("This is a marquee inside a TextView");
    text2.setSingleLine(true);
    text2.setHorizontalFadingEdgeEnabled(true);
    text2.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(100, LinearLayout.LayoutParams.WRAP_CONTENT);
    linearLayout.addView(text2, params);
    setContentView(linearLayout);
    getWindow().getDecorView().postDelayed(new Runnable() {

        @Override
        public void run() {
            text2.setVisibility(View.INVISIBLE);
            Animation animation = AnimationUtils.loadAnimation(text2.getContext(), R.anim.slide_off_left);
            animation.setFillEnabled(true);
            animation.setFillAfter(true);
            text2.startAnimation(animation);
        }
    }, 1000);
}
Also used : Animation(android.view.animation.Animation) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 72 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class Rotate3dTextActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    Rotate3dTextView view = new Rotate3dTextView(this);
    layout.addView(view, makeLayoutParams());
    view = new Rotate3dTextView(this);
    FrameLayout container = new FrameLayout(this);
    container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    container.addView(view);
    layout.addView(container, makeLayoutParams());
    setContentView(layout);
}
Also used : FrameLayout(android.widget.FrameLayout) LinearLayout(android.widget.LinearLayout)

Example 73 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class PowerTestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.v(LOGTAG, "onCreate, inst=" + Integer.toHexString(hashCode()));
    LinearLayout contentView = new LinearLayout(this);
    contentView.setOrientation(LinearLayout.VERTICAL);
    setContentView(contentView);
    setTitle("Idle");
    webView = new WebView(this);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
    webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
    webViewClient = new SimpleWebViewClient();
    chromeClient = new SimpleChromeClient();
    webView.setWebViewClient(webViewClient);
    webView.setWebChromeClient(chromeClient);
    contentView.addView(webView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0f));
    handler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            switch(msg.what) {
                case MSG_TIMEOUT:
                    handleTimeout();
                    return;
                case MSG_NAVIGATE:
                    manualDelay = msg.arg2;
                    navigate(msg.getData().getString(MSG_NAV_URL), msg.arg1);
                    logTime = msg.getData().getBoolean(MSG_NAV_LOGTIME);
                    return;
            }
        }
    };
    pageDoneLock = new Object();
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Message(android.os.Message) Handler(android.os.Handler) WebView(android.webkit.WebView) LinearLayout(android.widget.LinearLayout)

Example 74 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class GrantCredentialsPermissionActivity method onCreate.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.grant_credentials_permission);
    setTitle(R.string.grant_permissions_header_text);
    mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final Bundle extras = getIntent().getExtras();
    if (extras == null) {
        // we were somehow started with bad parameters. abort the activity.
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }
    // Grant 'account'/'type' to mUID
    mAccount = extras.getParcelable(EXTRAS_ACCOUNT);
    mAuthTokenType = extras.getString(EXTRAS_AUTH_TOKEN_TYPE);
    mUid = extras.getInt(EXTRAS_REQUESTING_UID);
    final PackageManager pm = getPackageManager();
    final String[] packages = pm.getPackagesForUid(mUid);
    if (mAccount == null || mAuthTokenType == null || packages == null) {
        // we were somehow started with bad parameters. abort the activity.
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }
    String accountTypeLabel;
    try {
        accountTypeLabel = getAccountLabel(mAccount);
    } catch (IllegalArgumentException e) {
        // label or resource was missing. abort the activity.
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }
    final TextView authTokenTypeView = (TextView) findViewById(R.id.authtoken_type);
    authTokenTypeView.setVisibility(View.GONE);
    final AccountManagerCallback<String> callback = new AccountManagerCallback<String>() {

        public void run(AccountManagerFuture<String> future) {
            try {
                final String authTokenLabel = future.getResult();
                if (!TextUtils.isEmpty(authTokenLabel)) {
                    runOnUiThread(new Runnable() {

                        public void run() {
                            if (!isFinishing()) {
                                authTokenTypeView.setText(authTokenLabel);
                                authTokenTypeView.setVisibility(View.VISIBLE);
                            }
                        }
                    });
                }
            } catch (OperationCanceledException e) {
            } catch (IOException e) {
            } catch (AuthenticatorException e) {
            }
        }
    };
    if (!AccountManager.ACCOUNT_ACCESS_TOKEN_TYPE.equals(mAuthTokenType)) {
        AccountManager.get(this).getAuthTokenLabel(mAccount.type, mAuthTokenType, callback, null);
    }
    findViewById(R.id.allow_button).setOnClickListener(this);
    findViewById(R.id.deny_button).setOnClickListener(this);
    LinearLayout packagesListView = (LinearLayout) findViewById(R.id.packages_list);
    for (String pkg : packages) {
        String packageLabel;
        try {
            packageLabel = pm.getApplicationLabel(pm.getApplicationInfo(pkg, 0)).toString();
        } catch (PackageManager.NameNotFoundException e) {
            packageLabel = pkg;
        }
        packagesListView.addView(newPackageView(packageLabel));
    }
    ((TextView) findViewById(R.id.account_name)).setText(mAccount.name);
    ((TextView) findViewById(R.id.account_type)).setText(accountTypeLabel);
}
Also used : Bundle(android.os.Bundle) IOException(java.io.IOException) PackageManager(android.content.pm.PackageManager) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 75 with LinearLayout

use of android.widget.LinearLayout in project android-topeka by googlesamples.

the class AbsQuizView method createContainerLayout.

private LinearLayout createContainerLayout(Context context) {
    LinearLayout container = new LinearLayout(context);
    container.setId(R.id.absQuizViewContainer);
    container.setOrientation(LinearLayout.VERTICAL);
    return container;
}
Also used : LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1205 View (android.view.View)473 TextView (android.widget.TextView)455 ViewGroup (android.view.ViewGroup)203 ImageView (android.widget.ImageView)196 Button (android.widget.Button)167 ScrollView (android.widget.ScrollView)125 ListView (android.widget.ListView)100 LayoutInflater (android.view.LayoutInflater)90 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)80 AdapterView (android.widget.AdapterView)74 EditText (android.widget.EditText)74 Intent (android.content.Intent)66 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)46 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42