List of usage examples for android.widget LinearLayout SHOW_DIVIDER_MIDDLE
int SHOW_DIVIDER_MIDDLE
To view the source code for android.widget LinearLayout SHOW_DIVIDER_MIDDLE.
Click Source Link
From source file:rus.cpuinfo.Ui.Fragments.Base.CpuInfoBaseTabFragment.java
@Nullable @Override//from w ww. j a v a 2 s. c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_tab, container, false); ButterKnife.bind(this, v); mViewPager.setAdapter(createAdapter()); mTabLayout.setupWithViewPager(mViewPager); View root = mTabLayout.getChildAt(0); if (root instanceof LinearLayout) { LinearLayout linearLayout = ((LinearLayout) root); linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); GradientDrawable drawable = new GradientDrawable(); drawable.setSize(2, 0); linearLayout.setDividerDrawable(drawable); } if (savedInstanceState != null) { mCurrentItem = savedInstanceState.getInt(SELECTED_TAB); } return v; }
From source file:com.afayear.android.client.view.TabPageIndicator.java
public TabPageIndicator(final Context context, final AttributeSet attrs) { super(context, attrs); setHorizontalScrollBarEnabled(false); mTabColor = ThemeUtils.getThemeColor(context); mInflater = LayoutInflater.from(context); mTabLayout = new LinearLayout(context); mTabLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); mShouldApplyColorFilterToTabIcons = ThemeUtils.shouldApplyColorFilterToTabIcons(context); mTabIconColor = ThemeUtils.getTabIconColor(context); addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
From source file:de.vanita5.twittnuker.view.TabPageIndicator.java
public TabPageIndicator(final Context context, final AttributeSet attrs) { super(context, attrs); setHorizontalScrollBarEnabled(false); mShouldApplyColorFilterToTabIcons = ThemeUtils.shouldApplyColorFilterToActionIcons(context); mTabHighlightColor = isInEditMode() ? 0 : ThemeUtils.getUserThemeColor(context); mTabIconColor = isInEditMode() ? 0 : ThemeUtils.getActionIconColor(context); mInflater = LayoutInflater.from(context); mTabLayout = new LinearLayout(context); mTabLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
From source file:edu.ptu.navpattern.tooltip.Tooltip.java
private View getContentView(final Builder builder) { GradientDrawable drawable = new GradientDrawable(); drawable.setColor(builder.mBackgroundColor); drawable.setCornerRadius(builder.mCornerRadius); LinearLayout vgContent = new LinearLayout(builder.mContext); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { vgContent.setBackground(drawable); } else {/*from w ww . ja v a 2 s. c o m*/ //noinspection deprecation vgContent.setBackgroundDrawable(drawable); } int padding = (int) builder.mPadding; vgContent.setPadding(padding, padding, padding, padding); vgContent.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0); textViewParams.gravity = Gravity.CENTER; textViewParams.topMargin = 1; vgContent.setLayoutParams(textViewParams); vgContent.setDividerDrawable(vgContent.getResources().getDrawable(R.drawable.divider_line)); vgContent.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); if (builder.itemText != null && builder.itemText.length > 0) { for (int i = 0; i < builder.itemText.length; i++) { TextView textView = new TextView(builder.mContext); textView.setText(builder.itemText[i]); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 44); textView.setTextColor(0xffffffff); textView.setGravity(Gravity.CENTER_VERTICAL); if (builder.itemLogo != null && builder.itemLogo.length > i) { Drawable drawableLeft = builder.mContext.getResources().getDrawable(builder.itemLogo[i]); /// ??,??. // drawableLeft.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); // textView.setCompoundDrawables(drawableLeft, null, null, null); // textView.setCompoundDrawablePadding(4); // textView.setBackgroundDrawable(drawableLeft); LinearLayout linearLayout = new LinearLayout(builder.mContext); linearLayout.setMinimumHeight((int) dpToPx(44f)); linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setGravity(Gravity.CENTER_VERTICAL); ImageView icon = new ImageView(builder.mContext); icon.setImageDrawable(drawableLeft); linearLayout.addView(icon); linearLayout.addView(textView); vgContent.addView(linearLayout); final int position = i; linearLayout.setClickable(false); linearLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (builder.mOnItemClickListener != null) { builder.mOnItemClickListener.onClick(position); } mTouchListener.onTouch(v, MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, v.getLeft() + 5, v.getTop() + 5, 0)); } }); } else { vgContent.addView(textView); final int position = i; textView.setClickable(false); textView.setMinimumHeight((int) dpToPx(44f)); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (builder.mOnItemClickListener != null) { builder.mOnItemClickListener.onClick(position); } mTouchListener.onTouch(v, null); } }); } } } mArrowView = new ImageView(builder.mContext); mArrowView.setImageDrawable(builder.mArrowDrawable); LinearLayout.LayoutParams arrowLayoutParams; if (mGravity == Gravity.TOP || mGravity == Gravity.BOTTOM) { arrowLayoutParams = new LinearLayout.LayoutParams((int) builder.mArrowWidth, (int) builder.mArrowHeight, 0); } else { arrowLayoutParams = new LinearLayout.LayoutParams((int) builder.mArrowHeight, (int) builder.mArrowWidth, 0); } arrowLayoutParams.gravity = Gravity.CENTER; mArrowView.setLayoutParams(arrowLayoutParams); mContentView = new LinearLayout(builder.mContext); mContentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mContentView.setOrientation(mGravity == Gravity.START || mGravity == Gravity.END ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); padding = (int) dpToPx(5); switch (mGravity) { case Gravity.START: mContentView.setPadding(0, 0, padding, 0); break; case Gravity.TOP: case Gravity.BOTTOM: mContentView.setPadding(padding, 0, padding, 0); break; case Gravity.END: mContentView.setPadding(padding, 0, 0, 0); break; } if (mGravity == Gravity.TOP || mGravity == Gravity.START) { mContentView.addView(vgContent); mContentView.addView(mArrowView); } else { mContentView.addView(mArrowView); mContentView.addView(vgContent); } if (builder.isCancelable || builder.isDismissOnClick) { mContentView.setOnTouchListener(mTouchListener); } return mContentView; }
From source file:co.ceryle.radiorealbutton.library.RadioRealButtonGroup.java
private void initViews() { setCornerRadius(radius);// ww w . j a v a2 s. c om BackgroundView backgroundView = new BackgroundView(getContext()); backgroundView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); backgroundView.setBackgroundColor(groupBackgroundColor); addView(backgroundView); selectorContainer = new LinearLayout(getContext()); selectorContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); selectorContainer.setOrientation(LinearLayout.HORIZONTAL); selectorContainer.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); RoundHelper.makeDividerRound(selectorContainer, selectorDividerColor, selectorDividerRadius, selectorDividerSize); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { selectorContainer.setDividerPadding(selectorDividerPadding); } addView(selectorContainer); container = new LinearLayout(getContext()); container.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); container.setOrientation(LinearLayout.HORIZONTAL); container.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); RoundHelper.makeDividerRound(container, dividerColor, dividerRadius, dividerSize); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { container.setDividerPadding(dividerPadding); } addView(container); v_bottomLine = new View(getContext()); v_bottomLine.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, 3)); addView(v_bottomLine); }
From source file:net.momodalo.app.vimtouch.VimTouch.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Log.e(VimTouch.LOG_TAG, "onCreate"); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mSettings = new VimSettings(getResources(), mPrefs); if (mSettings.getFullscreen() != ((getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0)) { doToggleFullscreen();//from w ww . j a v a 2 s.c o m } mUrl = getIntentUrl(getIntent()); TSIntent = new Intent(this, VimTermService.class); startService(TSIntent); if (!bindService(TSIntent, mTSConnection, BIND_AUTO_CREATE)) { Log.w(VimTouch.LOG_TAG, "bind to service failed!"); } if (Integer.valueOf(android.os.Build.VERSION.SDK) < 11) requestWindowFeature(Window.FEATURE_NO_TITLE); setBehindContentView(R.layout.menu); /* setup sliding menu */ setContentView(R.layout.term_activity); setSlidingActionBarEnabled(false); getSlidingMenu().setMode(SlidingMenu.LEFT); getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width); getSlidingMenu().setShadowDrawable(R.drawable.shadow); getSlidingMenu().setBehindOffsetRes(R.dimen.slidingmenu_offset); getSlidingMenu().setFadeDegree(0.35f); //getSlidingMenu().attachToActivity(this, SlidingMenu.SLIDING_CONTENT); mMenu = new FileListMenu(this); setSlidingMenuFragment(mMenu.getFragment()); getSlidingMenu().setOnCloseListener(new SlidingMenu.OnCloseListener() { public void onClose() { setTabLabels(mVimTabs); setCurTab(mVimCurTab); mMenu.onClose(); } }); getSlidingMenu().setOnOpenListener(new SlidingMenu.OnOpenListener() { public void onOpen() { mMenu.onOpen(); } }); mTopButtonBar = findViewById(R.id.top_bar); mBottomButtonBar = findViewById(R.id.bottom_bar); mLeftButtonBar = findViewById(R.id.left_bar); mRightButtonBar = findViewById(R.id.right_bar); mButtonBar = mTopButtonBar; mButtonBarLayout = (LinearLayout) findViewById(R.id.button_bar_layout); if (AndroidCompat.SDK >= 11) { mButtonBarLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE); } /* TextView button = (TextView)getLayoutInflater().inflate(R.layout.quickbutton, (ViewGroup)mButtonBarLayout, false); button.setText(R.string.title_keyboard); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ doToggleSoftKeyboard(); } }); */ ActionBarCompat actionBar = ActivityCompat.getActionBar(this); mTabSpinner = (Spinner) findViewById(R.id.tab_spinner); if (actionBar == null) { mTabSpinner.setVisibility(View.VISIBLE); // add tab spinner mTabSpinner.setOnItemSelectedListener(this); mTabAdapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item); mTabAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mTabSpinner.setAdapter(mTabAdapter); } else { mTabSpinner.setVisibility(View.GONE); actionBar.setNavigationMode(ActionBarCompat.NAVIGATION_MODE_LIST); actionBar.setDisplayShowTitleEnabled(false); mTabAdapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item); mTabAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBar.setListNavigationCallbacks(mTabAdapter, this); } mMainLayout = (LinearLayout) findViewById(R.id.main_layout); if (checkVimRuntime()) startEmulator(); Exec.vimtouch = this; }
From source file:net.momodalo.app.vimtouch.VimTouch.java
public void showCmdHistory() { final Dialog dialog = new Dialog(this, R.style.DialogSlideAnim); // Setting dialogview Window window = dialog.getWindow(); window.setGravity(Gravity.BOTTOM);/*w w w . j a v a 2s . c om*/ window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); dialog.setTitle(null); dialog.setContentView(R.layout.hist_list); dialog.setCancelable(true); LinearLayout layout = (LinearLayout) dialog.findViewById(R.id.hist_layout); if (AndroidCompat.SDK >= 11) { layout.setShowDividers(LinearLayout.SHOW_DIVIDER_BEGINNING | LinearLayout.SHOW_DIVIDER_MIDDLE | LinearLayout.SHOW_DIVIDER_END); } LayoutParams params = layout.getLayoutParams(); params.width = mScreenWidth; layout.setLayoutParams(params); LayoutInflater inflater = LayoutInflater.from(this); boolean exists = false; for (int i = 1; i <= 10; i++) { TextView button = (TextView) inflater.inflate(R.layout.histbutton, layout, false); String cmd = Exec.getCmdHistory(i); if (cmd.length() == 0) break; exists = true; button.setText(":" + cmd); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TextView text = (TextView) v; CharSequence cmd = text.getText(); Exec.doCommand(cmd.subSequence(1, cmd.length()).toString()); dialog.dismiss(); } }); layout.addView((View) button); } if (exists) dialog.show(); }