List of usage examples for android.widget LinearLayout LinearLayout
public LinearLayout(Context context)
From source file:com.alibaba.akita.widget.TabPageIndicator.java
public TabPageIndicator(Context context, AttributeSet attrs) { super(context, attrs); setHorizontalScrollBarEnabled(false); mInflater = LayoutInflater.from(context); mTabLayout = new LinearLayout(getContext()); addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT)); }
From source file:com.javielinux.facebook.FacebookHandler.java
public FacebookHandler(Activity activity) { if (activity != null) { this.activity = activity; layout = new LinearLayout(activity); activity.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); isWebViewShown = false;//ww w . ja v a 2s . c o m } }
From source file:com.android.calculator2.Fragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER);/*from w w w . j a v a 2 s . com*/ ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_VIEW_CONTAINER_ID); View cv = inflateView(savedInstanceState); cv.setId(android.R.id.content); lframe.addView(cv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; }
From source file:com.endiansoftware.echo.remotewatch.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { /*/*w w w .ja va2s . co m*/ // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Start the service, keeping the device awake while it is launching. startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); */ /* // ? ?? . Intent popupIntent = new Intent(context, Popup.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); // . context.startActivity(popupIntent); */ LinearLayout layout = new LinearLayout(context); //layout.setBackgroundResource(R.color.LightOrange); TextView tv = new TextView(context); // set the TextView properties like color, size etc tv.setTextColor(Color.RED); tv.setTextSize(15); tv.setGravity(Gravity.CENTER_VERTICAL); // set the text you want to show in Toast tv.setText("My Custom Toast at Bottom of Screen"); layout.addView(tv); Toast toast = new Toast(context); //context is object of Context write "this" if you are an Activity // Set The layout as Toast View toast.setView(layout); // Position you toast here toast position is 50 dp from bottom you can give any integral value toast.setGravity(Gravity.BOTTOM, 0, 50); toast.show(); }
From source file:com.andrew.apollo.ui.widgets.ScrollableTabView.java
public ScrollableTabView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs); this.mContext = context; mDividerMarginTop = (int) (getResources().getDisplayMetrics().density * mDividerMarginTop); mDividerMarginBottom = (int) (getResources().getDisplayMetrics().density * mDividerMarginBottom); mDividerWidth = (int) (getResources().getDisplayMetrics().density * mDividerWidth); this.setHorizontalScrollBarEnabled(false); this.setHorizontalFadingEdgeEnabled(false); mContainer = new LinearLayout(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); mContainer.setLayoutParams(params);/*from w ww. j ava2 s . c o m*/ mContainer.setOrientation(LinearLayout.HORIZONTAL); this.addView(mContainer); }
From source file:com.charon.video.view.ScrollingTabs.java
private void init(Context context) { this.setHorizontalScrollBarEnabled(false); this.setHorizontalFadingEdgeEnabled(false); mContainer = new LinearLayout(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); mContainer.setLayoutParams(params);/*from w w w.j a va2s .c o m*/ mContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mContainer); mWindowWidth = getWindowWidth(context); }
From source file:ch.pantas.billsplitter.ui.FixedTabsView.java
public FixedTabsView(Context context, AttributeSet attrs) { super(context, attrs); pageListener = new PageListener(); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer);// w w w . ja va 2 s . c o m rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Paint.Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); }
From source file:com.charon.scrollingtabs.view.ScrollingTabs.java
protected void init(Context context) { this.setHorizontalScrollBarEnabled(false); this.setHorizontalFadingEdgeEnabled(false); mContainer = new LinearLayout(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); mContainer.setLayoutParams(params);//from w w w . j a v a 2 s . c o m mContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mContainer); mWindowWidth = getWindowWidth(context); }
From source file:com.charon.materialsample.view.ScrollingTabs.java
protected void init(Context context) { this.setHorizontalScrollBarEnabled(false); this.setHorizontalFadingEdgeEnabled(false); mContainer = new LinearLayout(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mContainer.setLayoutParams(params);//from www . ja v a 2s. co m mContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mContainer); mWindowWidth = getWindowWidth(context); }
From source file:com.garage.payless.fragment.FragmentList.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.list_fragment, container, false); DelayAutoCompleteTextView bookTitle = (DelayAutoCompleteTextView) rootView.findViewById(R.id.book_title); bookTitle.setThreshold(4);/* www. j a v a2 s . c om*/ bookTitle.setAdapter(new GoodAutoCompleteAdapter(getActivity().getApplicationContext())); bookTitle.setLoadingIndicator((ProgressBar) rootView.findViewById(R.id.progress_bar)); bookTitle.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { LinearLayout basketList = (LinearLayout) rootView.findViewById(R.id.basket); LinearLayout row = new LinearLayout(getActivity().getApplicationContext()); row.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); row.setOrientation(LinearLayout.HORIZONTAL); TextView valueTV = new TextView(getActivity().getApplicationContext()); valueTV.setText((String) adapterView.getItemAtPosition(position)); valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); row.addView(valueTV); ImageButton cancel = new ImageButton(getActivity().getApplicationContext()); cancel.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); cancel.setImageDrawable(Drawable.createFromPath("@android:drawable/ic_menu_close_clear_cancel")); row.addView(cancel); basketList.addView(row); } }); rootView.findViewById(R.id.create_btn).setOnClickListener(this); return rootView; }