List of usage examples for android.widget LinearLayout setMinimumHeight
@RemotableViewMethod public void setMinimumHeight(int minHeight)
From source file:com.myfuture.view.WelcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.track_welcome_layout, container, false); ((TextView) v.findViewById(R.id.greeting)) .setText(getString(R.string.welcome_message, ParseUser.getCurrentUser().getString("firstName"))); LinearLayout welcomeBlock = (LinearLayout) v.findViewById(R.id.welcome_color_block); int actionBarHeight = getActivity().getActionBar().getHeight(); welcomeBlock.setMinimumHeight(actionBarHeight + 270); wecomeDescriptionTextView = (TextView) v.findViewById(R.id.welcome_description); ListView list = (ListView) v.findViewById(R.id.welcome_details_list); list.setAdapter(adapter);//from w ww . j a v a 2 s .c om return v; }
From source file:org.apache.cordova.SplashScreenInternal.java
/** * Shows the splash screen over the full Activity *///w w w .j a v a2 s .co m @SuppressWarnings("deprecation") private void showSplashScreen(final boolean hideAfterDelay) { final int splashscreenTime = preferences.getInteger("SplashScreenDelay", 3000); final int drawableId = preferences.getInteger("SplashDrawableId", 0); // If the splash dialog is showing don't try to show it again if (this.splashDialog != null && splashDialog.isShowing()) { return; } if (drawableId == 0 || (splashscreenTime <= 0 && hideAfterDelay)) { return; } cordova.getActivity().runOnUiThread(new Runnable() { public void run() { // Get reference to display Display display = cordova.getActivity().getWindowManager().getDefaultDisplay(); Context context = webView.getContext(); // Create the layout for the dialog LinearLayout root = new LinearLayout(context); root.setMinimumHeight(display.getHeight()); root.setMinimumWidth(display.getWidth()); root.setOrientation(LinearLayout.VERTICAL); // TODO: Use the background color of the webview's parent instead of using the // preference. root.setBackgroundColor(preferences.getInteger("backgroundColor", Color.BLACK)); root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0F)); root.setBackgroundResource(drawableId); // Create and show the dialog splashDialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar); // check to see if the splash screen should be full screen if ((cordova.getActivity().getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) { splashDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } splashDialog.setContentView(root); splashDialog.setCancelable(false); splashDialog.show(); // Set Runnable to remove splash screen just in case if (hideAfterDelay) { final Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { removeSplashScreen(); } }, splashscreenTime); } } }); }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * SINGLE TITLE ROW/* w ww .j ava 2s . co m*/ * @param att * @param linear * @return */ public LinearLayout getSingleTitleRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setMinimumHeight(30); container_layout .setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo_blue)); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView tx = new TextView(context); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value_params); LinearLayout.LayoutParams ltext1 = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView t1 = new TextView(context); t1.setText(att.get("value")); t1.setTextSize(11); t1.setGravity(Gravity.CENTER_HORIZONTAL); t1.setPadding(2, 0, 0, 2); t1.setTextColor(Color.rgb(255, 255, 255)); container_layout.addView(t1, ltext1); linear.addView(container_layout); return linear; }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * DOUBLE TITLE ROW/* w ww. j a v a 2s . c o m*/ * @param att * @param linear * @return */ public LinearLayout getDoubleTitleRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setMinimumHeight(30); container_layout .setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo_blue)); container_layout.setVerticalGravity(Gravity.CENTER); container_layout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.3f); TextView tx = new TextView(context); tx.setText(""); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value_params); LinearLayout.LayoutParams ltext1 = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.35f); TextView t1 = new TextView(context); t1.setText(att.get("value1")); t1.setTextSize(11); t1.setGravity(Gravity.CENTER_HORIZONTAL); t1.setPadding(2, 0, 0, 2); t1.setTextColor(Color.rgb(255, 255, 255)); container_layout.addView(t1, ltext1); LinearLayout.LayoutParams ltext2 = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.35f); TextView t2 = new TextView(context); t2.setText(att.get("value2")); t2.setTextSize(11); t2.setGravity(Gravity.CENTER_HORIZONTAL); t2.setPadding(2, 0, 0, 2); t2.setTextColor(Color.rgb(255, 255, 255)); container_layout.addView(t2, ltext2); linear.addView(container_layout); return linear; }
From source file:com.example.android.animationsdemo.BoardFragment.java
public void createCol() { int colNo = board.getColNo(); Log.i("colNo", "colNo=" + colNo); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size);/*from w ww . j a va 2s .c o m*/ int width = size.x; int height = size.y; Log.i("conditions", "codition start=" + Math.max(0, start) + "\n check = " + Math.min(start + MAX_COL_DISPLAYED, board.getColNo()) + "in createCOl"); for (int i = Math.max(0, start); i < Math.min(start + MAX_COL_DISPLAYED, board.getColNo()); i++) { LayoutInflater inflater = LayoutInflater.from(context); View columnView = inflater.inflate(R.layout.columns_layout, null, false); LinearLayout ll = (LinearLayout) columnView.findViewById(R.id.ll); ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f / MAX_COL_DISPLAYED)); TextView tv = (TextView) columnView.findViewById(R.id.tv); tv.setText(board.getColName(i)); Button addCard = (Button) columnView.findViewById(R.id.addCard); LinearLayout cardContainerLayout = (LinearLayout) columnView.findViewById(R.id.cardContainer); cardContainerLayout.setTag("col" + board.getColName(i)); cardContainerLayout.setId(position); cardContainerLayout.setMinimumHeight(height); cardContainerLayout.setMinimumWidth(width / MAX_COL_DISPLAYED); Log.i("Drag", "Calling drag constructor "); cardContainerLayout.setOnDragListener(new MyDragListener(rootViewGroup)); Log.i("Drag", "Drag Constructor Called "); addCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { BoardFragment.this.addItem(view); } }); //cardContainerLayout.setLayoutTransition(new LayoutTransition()); rootViewGroup.addView(columnView); } }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * SINGLE IMAGE ROW/*from w w w . j a va 2s . com*/ * @param att * @param linear * @return */ public LinearLayout getSingleImageRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo)); container_layout.setMinimumHeight(46); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView tx = new TextView(context); tx.setText(att.get("title")); tx.setTextSize(11); tx.setTypeface(null, Typeface.BOLD); tx.setGravity(Gravity.LEFT); tx.setPadding(3, 0, 0, 2); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 40, 0.5f); ImageView img = new ImageView(context); String path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value")); img.setImageResource(context.getResources().getIdentifier(path, null, null)); img.setPadding(0, 3, 0, 3); container_layout.addView(img, value_params); linear.addView(container_layout); return linear; }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * SINGLE TEXT ROW//from www. ja v a2 s.c om * @param att * @param linear * @return */ public LinearLayout getSingleTextRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo)); container_layout.setMinimumHeight(46); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView tx = new TextView(context); tx.setText(att.get("title")); tx.setTextSize(11); tx.setTypeface(null, Typeface.BOLD); tx.setGravity(Gravity.LEFT); tx.setPadding(3, 0, 0, 2); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView t2 = new TextView(context); t2.setText(att.get("value").equals("") ? " - " : att.get("value")); t2.setTextSize(11); t2.setGravity(Gravity.CENTER_HORIZONTAL); t2.setPadding(2, 0, 0, 2); t2.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(t2, value_params); linear.addView(container_layout); return linear; }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * DOUBLE IMAGE ROW/* w w w . j av a 2s .c o m*/ * @param att * @param linear * @return */ public LinearLayout getDoubleImageRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo)); container_layout.setMinimumHeight(46); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.3f); TextView tx = new TextView(context); tx.setText(att.get("title")); tx.setTextSize(11); tx.setTypeface(null, Typeface.BOLD); tx.setGravity(Gravity.LEFT); tx.setPadding(3, 0, 0, 2); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value_params); LinearLayout.LayoutParams value_one_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 46, 0.35f); ImageView img1 = new ImageView(context); String path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value1")); img1.setImageResource(context.getResources().getIdentifier(path, null, null)); img1.setPadding(0, 3, 0, 3); container_layout.addView(img1, value_one_params); LinearLayout.LayoutParams value_two_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 46, 0.35f); ImageView img2 = new ImageView(context); path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value2")); img2.setImageResource(context.getResources().getIdentifier(path, null, null)); img2.setPadding(0, 3, 0, 3); container_layout.addView(img2, value_two_params); linear.addView(container_layout); return linear; }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * DOUBLE TEXT ROW// www . ja v a2 s . c om * @param att * @param linear * @return */ public LinearLayout getDoubleTextRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo)); container_layout.setMinimumHeight(46); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.3f); TextView tx = new TextView(context); tx.setText(att.get("title")); tx.setTextSize(11); tx.setTypeface(null, Typeface.BOLD); tx.setGravity(Gravity.LEFT); tx.setPadding(2, 0, 0, 2); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value_params); LinearLayout.LayoutParams value_one_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.35f); TextView t1 = new TextView(context); t1.setText(att.get("value1").equals("") ? " - " : att.get("value1")); t1.setTextSize(11); t1.setGravity(Gravity.CENTER_HORIZONTAL); t1.setPadding(2, 0, 0, 2); t1.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(t1, value_one_params); LinearLayout.LayoutParams value_two_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.35f); TextView t2 = new TextView(context); t2.setTextSize(11); t2.setText(att.get("value2").equals("") ? " - " : att.get("value2")); t2.setGravity(Gravity.CENTER_HORIZONTAL); t2.setPadding(2, 0, 0, 2); t2.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(t2, value_two_params); linear.addView(container_layout); return linear; }
From source file:org.liberty.android.fantastischmemo.downloader.google.GoogleOAuth2AccessCodeRetrievalFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); final View v = inflater.inflate(R.layout.oauth_login_layout, container, false); final WebView webview = (WebView) v.findViewById(R.id.login_page); final View loadingText = v.findViewById(R.id.auth_page_load_text); final View progressDialog = v.findViewById(R.id.auth_page_load_progress); final LinearLayout ll = (LinearLayout) v.findViewById(R.id.ll); // We have to set up the dialog's webview size manually or the webview will be zero size. // This should be a bug of Android. Rect displayRectangle = new Rect(); Window window = mActivity.getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle); ll.setMinimumWidth((int) (displayRectangle.width() * 0.9f)); ll.setMinimumHeight((int) (displayRectangle.height() * 0.8f)); webview.getSettings().setJavaScriptEnabled(true); try {/* w w w .j ava2 s. co m*/ String uri = String.format( "https://accounts.google.com/o/oauth2/auth?client_id=%s&response_type=%s&redirect_uri=%s&scope=%s", URLEncoder.encode(AMEnv.GOOGLE_CLIENT_ID, "UTF-8"), URLEncoder.encode("code", "UTF-8"), URLEncoder.encode(AMEnv.GOOGLE_REDIRECT_URI, "UTF-8"), URLEncoder.encode(AMEnv.GDRIVE_SCOPE, "UTF-8")); webview.loadUrl(uri); } catch (Exception e) { throw new RuntimeException(e); } // This is workaround to show input on some android version. webview.requestFocus(View.FOCUS_DOWN); webview.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: if (!v.hasFocus()) { v.requestFocus(); } break; } return false; } }); webview.setWebViewClient(new WebViewClient() { private boolean authenticated = false; @Override public void onPageFinished(WebView view, String url) { loadingText.setVisibility(View.GONE); progressDialog.setVisibility(View.GONE); webview.setVisibility(View.VISIBLE); if (authenticated == true) { return; } String code = getAuthCodeFromUrl(url); String error = getErrorFromUrl(url); if (error != null) { authCodeReceiveListener.onAuthCodeError(error); authenticated = true; dismiss(); } if (code != null) { authenticated = true; authCodeReceiveListener.onAuthCodeReceived(code); dismiss(); } } }); return v; }