List of usage examples for android.view Gravity CENTER
int CENTER
To view the source code for android.view Gravity CENTER.
Click Source Link
From source file:com.insthub.O2OMobile.Activity.B0_SigninActivity.java
@Override public void onClick(View v) { String mobile = mMobile.getText().toString(); String password = mPassword.getText().toString(); switch (v.getId()) { case R.id.tv_signup: Intent intent = new Intent(this, B1_SignupVerifyActivity.class); startActivity(intent);//from w ww . ja v a 2 s . c om CloseKeyBoard(); break; case R.id.btn_login: if ("".equals(mobile)) { ToastView toast = new ToastView(this, getString(R.string.please_input_mobile_phone)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mMobile.requestFocus(); } else if ("".equals(password)) { ToastView toast = new ToastView(this, getString(R.string.please_input_password)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mPassword.requestFocus(); } else if (mobile.length() < 11) { ToastView toast = new ToastView(this, getString(R.string.wrong_mobile_phone)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mMobile.requestFocus(); } else if (password.length() < 6 || password.length() > 20) { ToastView toast = new ToastView(this, getString(R.string.please_enter_correct_password_format)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mPassword.requestFocus(); } else { CloseKeyBoard(); mUserModel = new UserModel(B0_SigninActivity.this); mUserModel.addResponseListener(this); mUserModel.login(mobile, password); } break; } }
From source file:com.bangqu.eshow.util.ESDialogUtil.java
/** * ?/*from w ww . ja v a2 s.c om*/ * @param view * @param onCancelListener * @return */ public static ESSampleDialogFragment showDialog(View view, int style, DialogInterface.OnCancelListener onCancelListener) { return showDialog(view, Gravity.CENTER, style, onCancelListener); }
From source file:by.istin.android.xcore.fragment.AdapterViewFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * /*from w ww. ja va2s . com*/ * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. */ @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); 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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); AdapterView adapterView = createDefaultAbstractView(); adapterView.setId(android.R.id.list); if (adapterView instanceof ListView) { ((ListView) adapterView).setDrawSelectorOnTop(false); } lframe.addView(adapterView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:br.ufrn.dimap.pubshare.download.service.DownloaderService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Toast toast = Toast.makeText(this, "Starting download. see action bar to see the progress.", Toast.LENGTH_SHORT);/* w w w . j a v a2 s. c o m*/ toast.setGravity(Gravity.BOTTOM | Gravity.CENTER, 0, 0); toast.show(); return super.onStartCommand(intent, flags, startId); }
From source file:cn.org.eshow.framwork.util.AbDialogUtil.java
/** * ?//from ww w. j a v a2 s .c o m * @param view * @param onCancelListener * @return */ public static AbSampleDialogFragment showDialog(View view, int style, DialogInterface.OnCancelListener onCancelListener) { return showDialog(view, Gravity.CENTER, style, onCancelListener); }
From source file:com.insthub.O2OMobile.Activity.C3_EditNameActivity.java
@Override public void OnMessageResponse(String url, JSONObject jo, AjaxStatus status) throws JSONException { if (url.endsWith(ApiInterface.USER_CHANGE_PROFILE)) { ToastView toast = new ToastView(C3_EditNameActivity.this, getString(R.string.edit_nickname_success)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/* w w w .j av a 2 s. c o m*/ finish(); } }
From source file:com.firesoft.member.Activity.B1_SignupVerifyActivity.java
@Override public void onClick(View v) { String mobile = mMobile.getText().toString(); String verify_code = mVerifyCode.getText().toString().trim(); switch (v.getId()) { case R.id.tv_login: CloseKeyBoard();/* w ww. ja v a2 s . c o m*/ finish(); break; case R.id.btn_next: if ("".equals(mobile)) { ToastView toast = new ToastView(this, getString(R.string.please_input_mobile_phone)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mMobile.requestFocus(); } else if (mobile.length() < 11) { ToastView toast = new ToastView(this, getString(R.string.wrong_mobile_phone)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mMobile.requestFocus(); } else if ("".equals(verify_code)) { ToastView toast = new ToastView(this, getString(R.string.please_input_verify_code)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mVerifyCode.setText(""); mVerifyCode.requestFocus(); } else if (verify_code.length() < 4 || !"1234".equals(verify_code)) { ToastView toast = new ToastView(this, "??1234?"); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mVerifyCode.requestFocus(); } else if ("1234".equals(verify_code)) { Intent intent = new Intent(this, B2_SignupActivity.class); intent.putExtra(B2_SignupActivity.MOBILE, mMobile.getText().toString()); startActivity(intent); } break; case R.id.btn_get_verify_code_again: if ("".equals(mobile)) { ToastView toast = new ToastView(this, getString(R.string.please_input_mobile_phone)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mMobile.requestFocus(); } else if (mobile.length() < 11) { ToastView toast = new ToastView(this, getString(R.string.wrong_mobile_phone)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mMobile.requestFocus(); } else { ToastView toast = new ToastView(this, "??1234?"); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); mVerifyCode.requestFocus(); } break; } }
From source file:com.ab.view.sliding.AbBottomTabView.java
/** * Instantiates a new ab bottom tab view. * * @param context the context/* w ww. j a va 2 s . c om*/ * @param attrs the attrs */ public AbBottomTabView(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; this.setOrientation(LinearLayout.VERTICAL); this.setBackgroundColor(Color.rgb(255, 255, 255)); mTabLayout = new LinearLayout(context); mTabLayout.setOrientation(LinearLayout.HORIZONTAL); mTabLayout.setGravity(Gravity.CENTER); //View? mViewPager = new ViewPager(context); //ViewPager,setId()id mViewPager.setId(1985); pagerItemList = new ArrayList<Fragment>(); this.addView(mViewPager, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1)); addView(mTabLayout, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); //Tab? tabItemList = new ArrayList<AbTabItemView>(); tabItemTextList = new ArrayList<String>(); tabItemDrawableList = new ArrayList<Drawable>(); //?FragmentActivity if (!(this.context instanceof FragmentActivity)) { AbLogUtil.e(AbBottomTabView.class, "AbSlidingTabView?context,FragmentActivity"); } FragmentManager mFragmentManager = ((FragmentActivity) this.context).getFragmentManager(); mFragmentPagerAdapter = new AbFragmentPagerAdapter(mFragmentManager, pagerItemList); mViewPager.setAdapter(mFragmentPagerAdapter); mViewPager.setOnPageChangeListener(new MyOnPageChangeListener()); mViewPager.setOffscreenPageLimit(3); }
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * SINGLE TITLE ROW// ww w. jav a 2 s . c o 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:com.QuarkLabs.BTCeClient.fragments.OrdersBookFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);//from w ww. j a va 2s . c o m @SuppressLint("InflateParams") View v = inflater.inflate(R.layout.fragment_ordersbook, container, false); mAsksList = (ListView) v.findViewById(R.id.asks); mBidsList = (ListView) v.findViewById(R.id.bids); mChartArea = (FrameLayout) v.findViewById(R.id.OrdersBookChart); mLoadingViewAsks = new ProgressBar(getActivity()); mLoadingViewBids = new ProgressBar(getActivity()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT); lp.gravity = Gravity.CENTER; mLoadingViewAsks.setLayoutParams(lp); mLoadingViewBids.setLayoutParams(lp); ((LinearLayout) mAsksList.getParent()).addView(mLoadingViewAsks); mAsksList.setEmptyView(mLoadingViewAsks); ((LinearLayout) mBidsList.getParent()).addView(mLoadingViewBids); mBidsList.setEmptyView(mLoadingViewBids); ActionBarActivity hostActivity = (ActionBarActivity) getActivity(); hostActivity.getSupportActionBar().setCustomView(mPairsSpinner, new ActionBar.LayoutParams(Gravity.END)); hostActivity.getSupportActionBar().setDisplayShowCustomEnabled(true); return v; }