Java Code Examples for android.widget.ScrollView#setVerticalScrollBarEnabled()

The following examples show how to use android.widget.ScrollView#setVerticalScrollBarEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionBarPopupWindow.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed).mutate();
    backgroundDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY));

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        FileLog.e(e);
    }


    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example 2
Source File: ActionBarPopupWindow.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed).mutate();
    backgroundDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY));

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        FileLog.e(e);
    }


    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example 3
Source File: ActionBarPopupWindow.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed_alert2).mutate();
    setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        FileLog.e(e);
    }

    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new ScrollView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example 4
Source File: ActionBarPopupWindow.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed_alert2).mutate();
    setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        FileLog.e(e);
    }

    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new ScrollView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example 5
Source File: ActionBarPopupWindow.java    From KrGallery with GNU General Public License v2.0 5 votes vote down vote up
public ActionBarPopupWindowLayout(Context context) {
    super(context);

    if (backgroundDrawable == null) {
        backgroundDrawable = getResources().getDrawable(R.drawable.popup_fixed);
    }

    setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8), AndroidUtilities.dp(8));
    setWillNotDraw(false);

    try {
        scrollView = new ScrollView(context);
        scrollView.setVerticalScrollBarEnabled(false);
        addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    } catch (Throwable e) {
        e.printStackTrace();
    }


    linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    if (scrollView != null) {
        scrollView.addView(linearLayout, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    } else {
        addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
    }
}
 
Example 6
Source File: UIAlertDialog.java    From UIWidget with Apache License 2.0 5 votes vote down vote up
private void createContainerView() {
    mLLayoutContainer = new LinearLayout(mContext);
    mLLayoutContainer.setId(R.id.lLayout_containerAlertDialog);
    mLLayoutContainer.setLayoutParams(new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, 0, 1.0f));
    mLLayoutContainer.setOrientation(LinearLayout.VERTICAL);
    mLLayoutContainer.setPadding(mPadding, dp2px(12), mPadding, dp2px(12));
    mLLayoutContainer.setGravity(mCenterGravity);

    mLLayoutRoot.addView(mLLayoutContainer);

    mLLayoutView = new LinearLayout(mContext);
    mLLayoutContainer.setId(R.id.lLayout_ViewAlertDialog);
    mLLayoutView.setOrientation(LinearLayout.VERTICAL);
    mLLayoutView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    mSvView = new ScrollView(mContext);
    mSvView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mSvView.setOverScrollMode(View.OVER_SCROLL_NEVER);
    mSvView.setVerticalScrollBarEnabled(false);
    mSvView.addView(mLLayoutView);

    mLLayoutContainer.addView(mSvView);
    if (mListViews != null) {
        for (View v : mListViews) {
            mLLayoutView.addView(v);
        }
    }

}
 
Example 7
Source File: FaceActivity.java    From Android-HowOld with MIT License 5 votes vote down vote up
private void initViews() {
	mPhoto = (ImageView) findViewById(R.id.id_photo);
	mGetImage = (ImageButton) findViewById(R.id.id_getImage);
	mDetect = (TextView) findViewById(R.id.id_detect);
	// mTip = (TextView) findViewById(R.id.id_tip);
	mWaitting = findViewById(R.id.id_waiting);

	gallery = (Gallery) findViewById(R.id.id_gallery);
	imageSwitcher = (ImageSwitcher) findViewById(R.id.id_imageSwitcher);
	scrollView = (ScrollView) findViewById(R.id.scrollView1);
	scrollView.setVerticalScrollBarEnabled(false);

}
 
Example 8
Source File: PopupTaplist.java    From PdDroidPublisher with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle("Select value");

	final LinearLayout view = new LinearLayout(getContext());
	final ScrollView sview = new ScrollView(getContext());
	view.setOrientation(LinearLayout.VERTICAL);
	sview.setVerticalScrollBarEnabled(true);


	for (int i = 0; i < values.size(); i++) {
		final Button button = new Button(getContext());
		String s = values.get(i);
		button.setText(s);
		button.setId(i);

		button.setOnClickListener(new View.OnClickListener() {
			@Override	
			public void onClick(View v) {
			
				selectedValue = (Integer) button.getId();
				Selector.this.dismiss();
			}
		});
		view.addView(button);
	}
	sview.addView(view);
	setContentView(sview);
}
 
Example 9
Source File: DisplayModelActivity.java    From nosey with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    textSize = (int) getResources().getDimension(R.dimen.cell_text_size);
    padding = (int) getResources().getDimension(R.dimen.cell_padding);
    
    Nosey nosey = Nosey.getInstance(this);
    Inspector.ModelMapInspector inspector = new Inspector.ModelMapInspector();
    inspector.inspect(nosey);

    String modelKey = getIntent().getStringExtra(EXTRA_MODEL_KEY);
    model = inspector.getModelMap().get(modelKey);
    methods = model.getDeclaredMethods();
    Arrays.sort(methods, new MemberComparator<Method>());
    
    TableLayout table = new TableLayout(this);
    addModelFieldHeaders(table, inspector);
    addModelDataRows(table, inspector);

    ScrollView scrollView = new ScrollView(this);
    scrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    scrollView.setHorizontalScrollBarEnabled(true);
    scrollView.setVerticalScrollBarEnabled(true);
    scrollView.setFillViewport(true);

    HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
    horizontalScrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    horizontalScrollView.setHorizontalScrollBarEnabled(true);
    horizontalScrollView.setVerticalScrollBarEnabled(true);
    horizontalScrollView.setFillViewport(true);
    
    scrollView.addView(horizontalScrollView);
    horizontalScrollView.addView(table);
    
    setContentView(scrollView);
}
 
Example 10
Source File: DisplayModelActivity.java    From nosey with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    textSize = (int) getResources().getDimension(R.dimen.cell_text_size);
    padding = (int) getResources().getDimension(R.dimen.cell_padding);
    
    Nosey nosey = Nosey.getInstance(this);
    Inspector.ModelMapInspector inspector = new Inspector.ModelMapInspector();
    inspector.inspect(nosey);

    String modelKey = getIntent().getStringExtra(EXTRA_MODEL_KEY);
    model = inspector.getModelMap().get(modelKey);
    methods = model.getDeclaredMethods();
    Arrays.sort(methods, new MemberComparator<Method>());
    
    TableLayout table = new TableLayout(this);
    addModelFieldHeaders(table, inspector);
    addModelDataRows(table, inspector);

    ScrollView scrollView = new ScrollView(this);
    scrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    scrollView.setHorizontalScrollBarEnabled(true);
    scrollView.setVerticalScrollBarEnabled(true);
    scrollView.setFillViewport(true);

    HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
    horizontalScrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    horizontalScrollView.setHorizontalScrollBarEnabled(true);
    horizontalScrollView.setVerticalScrollBarEnabled(true);
    horizontalScrollView.setFillViewport(true);
    
    scrollView.addView(horizontalScrollView);
    horizontalScrollView.addView(table);
    
    setContentView(scrollView);
}
 
Example 11
Source File: HelpActivity.java    From Noyze with Apache License 2.0 4 votes vote down vote up
/**
 * Generates our layout in-code. Only called once, then
 * we'll be sure to recycle these {@link View}s.
 */
public final View makeLayout() {

	// Layout Parameters.
          DisplayMetrics dm = new DisplayMetrics();
          WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
          wm.getDefaultDisplay().getMetrics(dm);
          final int[] mWindowDims = new int[] { dm.widthPixels, dm.heightPixels };
	final int mWindowWidth = mWindowDims[0],
			  mMaxWidth = mContext.getResources().getDimensionPixelSize(R.dimen.max_menu_width);
	final int gutter = mContext.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
	final FrameLayout.LayoutParams mParams = new FrameLayout.LayoutParams(
		((mWindowWidth > mMaxWidth) ? mMaxWidth : android.view.ViewGroup.LayoutParams.MATCH_PARENT),
		android.view.ViewGroup.LayoutParams.MATCH_PARENT);
	final RelativeLayout.LayoutParams mTextParams = new RelativeLayout.LayoutParams(
		android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
	mTextParams.addRule(RelativeLayout.CENTER_IN_PARENT);
	mParams.gravity = Gravity.CENTER;
	
	// Main text and image.
	final TextView text = new TextView(mContext);
          text.setTextColor(Color.DKGRAY);
	text.setId(R.id.help_text);
	text.setLayoutParams(mTextParams);
	text.setGravity(Gravity.CENTER_HORIZONTAL);
	text.setMovementMethod(LinkMovementMethod.getInstance());
	text.setLinksClickable(true);
	final int mTextSize = mContext.getResources()
		.getDimensionPixelSize(R.dimen.help_text_size);
	text.setTextSize(mTextSize);
	
	text.setCompoundDrawablePadding((gutter/2));
	text.setPadding(gutter, gutter, gutter, gutter);
	
	// Allow the View to Scroll vertically if necessary.
	final ScrollView scroll = new ScrollView(mContext);
	scroll.setLayoutParams(mParams);
	scroll.setFillViewport(true);
	scroll.setSmoothScrollingEnabled(true);
	scroll.setVerticalScrollBarEnabled(false);
	final RelativeLayout layout = new RelativeLayout(mContext);
	mParams.topMargin = mParams.bottomMargin = mContext.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin);
          mParams.leftMargin = mParams.rightMargin = mContext.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
	layout.setLayoutParams(mParams);
	layout.addView(text);
	scroll.addView(layout);
	
	return scroll;
}
 
Example 12
Source File: HelpActivity.java    From Noyze with Apache License 2.0 4 votes vote down vote up
/**
 * Generates our layout in-code. Only called once, then
 * we'll be sure to recycle these {@link View}s.
 */
public final View makeLayout() {

	// Layout Parameters.
          DisplayMetrics dm = new DisplayMetrics();
          WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
          wm.getDefaultDisplay().getMetrics(dm);
          final int[] mWindowDims = new int[] { dm.widthPixels, dm.heightPixels };
	final int mWindowWidth = mWindowDims[0],
			  mMaxWidth = mContext.getResources().getDimensionPixelSize(R.dimen.max_menu_width);
	final int gutter = mContext.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
	final FrameLayout.LayoutParams mParams = new FrameLayout.LayoutParams(
		((mWindowWidth > mMaxWidth) ? mMaxWidth : android.view.ViewGroup.LayoutParams.MATCH_PARENT),
		android.view.ViewGroup.LayoutParams.MATCH_PARENT);
	final RelativeLayout.LayoutParams mTextParams = new RelativeLayout.LayoutParams(
		android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
	mTextParams.addRule(RelativeLayout.CENTER_IN_PARENT);
	mParams.gravity = Gravity.CENTER;
	
	// Main text and image.
	final TextView text = new TextView(mContext);
          text.setTextColor(Color.DKGRAY);
	text.setId(R.id.help_text);
	text.setLayoutParams(mTextParams);
	text.setGravity(Gravity.CENTER_HORIZONTAL);
	text.setMovementMethod(LinkMovementMethod.getInstance());
	text.setLinksClickable(true);
	final int mTextSize = mContext.getResources()
		.getDimensionPixelSize(R.dimen.help_text_size);
	text.setTextSize(mTextSize);
	
	text.setCompoundDrawablePadding((gutter/2));
	text.setPadding(gutter, gutter, gutter, gutter);
	
	// Allow the View to Scroll vertically if necessary.
	final ScrollView scroll = new ScrollView(mContext);
	scroll.setLayoutParams(mParams);
	scroll.setFillViewport(true);
	scroll.setSmoothScrollingEnabled(true);
	scroll.setVerticalScrollBarEnabled(false);
	final RelativeLayout layout = new RelativeLayout(mContext);
	mParams.topMargin = mParams.bottomMargin = mContext.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin);
          mParams.leftMargin = mParams.rightMargin = mContext.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
	layout.setLayoutParams(mParams);
	layout.addView(text);
	scroll.addView(layout);
	
	return scroll;
}
 
Example 13
Source File: BootstrapDropDown.java    From Android-Bootstrap with MIT License 4 votes vote down vote up
private ScrollView createDropDownView() {
    final LinearLayout dropdownView = new LinearLayout(getContext());
    ScrollView scrollView = new ScrollView(getContext());
    int clickableChildCounter = 0;

    dropdownView.setOrientation(LinearLayout.VERTICAL);
    int height = (int) (itemHeight * bootstrapSize);
    LayoutParams childParams = new LayoutParams(LayoutParams.MATCH_PARENT, height);

    for (String text : dropdownData) {
        TextView childView = new TextView(getContext());
        childView.setGravity(Gravity.CENTER_VERTICAL);
        childView.setLayoutParams(childParams);

        int padding = (int) (baselineItemLeftPadding * bootstrapSize);
        childView.setPadding(padding, 0, padding, 0);
        childView.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
        childView.setTextColor(ColorUtils.resolveColor(android.R.color.black, getContext()));

        Drawable background = getContext().obtainStyledAttributes(null, new int[]{
                android.R.attr.selectableItemBackground}, 0, 0)
                                        .getDrawable(0);
        ViewUtils.setBackgroundDrawable(childView, background);

        childView.setTextColor(BootstrapDrawableFactory.bootstrapDropDownViewText(getContext()));
        childView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dropdownWindow.dismiss();
                if (onDropDownItemClickListener != null) {
                    onDropDownItemClickListener.onItemClick(dropdownView, v, v.getId());
                }
            }
        });

        if (Pattern.matches(SEARCH_REGEX_HEADER, text)) {
            childView.setText(text.replaceFirst(REPLACE_REGEX_HEADER, ""));
            childView.setTextSize((baselineDropDownViewFontSize - 2F) * bootstrapSize);
            childView.setClickable(false);
            childView.setTextColor(ColorUtils.resolveColor(R.color.bootstrap_gray_light,
                                                           getContext()));
        }
        else if (Pattern.matches(SEARCH_REGEX_SEPARATOR, text)) {
            childView = new DividerView(getContext());
            childView.setClickable(false);
            childView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 3));
        }
        else if (Pattern.matches(SEARCH_REGEX_DISABLED, text)) {
            childView.setEnabled(false);
            childView.setId(clickableChildCounter++);
            childView.setText(text.replaceFirst(REPLACE_REGEX_DISABLED, ""));
        }
        else {
            childView.setText(text);
            childView.setId(clickableChildCounter++);
        }
        dropdownView.addView(childView);
    }

    dropdownView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
    dropDownViewHeight = dropdownView.getMeasuredHeight();
    dropDownViewWidth = dropdownView.getMeasuredWidth();

    scrollView.setVerticalScrollBarEnabled(false);
    scrollView.setHorizontalScrollBarEnabled(false);
    scrollView.addView(dropdownView);

    cleanData();
    return scrollView;
}