android.widget.HorizontalScrollView#setHorizontalScrollBarEnabled ( )源码实例Demo

下面列出了android.widget.HorizontalScrollView#setHorizontalScrollBarEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: NavigationBar   文件: NavitationScrollLayout.java
public NavitationScrollLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    margleft = dip2px(context, 0);
    titleLayout = new LinearLayout(context);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
    titleLayout.setLayoutParams(layoutParams);
    titleLayout.setOrientation(LinearLayout.HORIZONTAL);
    titleLayout.setGravity(Gravity.CENTER_VERTICAL);

    LayoutParams layoutParams2 = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
    horizontalScrollView = new HorizontalScrollView(context);
    horizontalScrollView.addView(titleLayout, layoutParams2);
    horizontalScrollView.setHorizontalScrollBarEnabled(false);

    addView(horizontalScrollView);
}
 
源代码2 项目: Huochexing12306   文件: EditPage.java
private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpTb = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LinearLayout.LayoutParams lpSv = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
源代码3 项目: BigApp_Discuz_Android   文件: EditPage.java
private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LayoutParams lpTb = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LayoutParams lpShareTo = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LayoutParams lpSv = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
源代码4 项目: BigApp_WordPress_Android   文件: EditPage.java
private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LayoutParams lpTb = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LayoutParams lpShareTo = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LayoutParams lpSv = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
源代码5 项目: nosey   文件: DisplayModelActivity.java
@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);
}
 
源代码6 项目: WeCenterMobile-Android   文件: EditPage.java
private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpTb = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LinearLayout.LayoutParams lpSv = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpTb = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LinearLayout.LayoutParams lpSv = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
源代码8 项目: nosey   文件: DisplayModelActivity.java
@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);
}
 
源代码9 项目: xdroid   文件: HorizontalSpinner.java
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    mLinearLayout = new LinearLayout(getContext());
    mLinearLayout.setOrientation(LinearLayout.HORIZONTAL);

    mScrollView = new HorizontalScrollView(getContext());
    mScrollView.addView(mLinearLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mScrollView.setHorizontalScrollBarEnabled(isHorizontalScrollBarEnabled());

    addView(mScrollView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    updateState();
}
 
源代码10 项目: AndroidLinkup   文件: EditPage.java
private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpTb = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LinearLayout.LayoutParams lpSv = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
源代码11 项目: MaterialTabs   文件: MaterialTabHost.java
public MaterialTabHost(Context context, AttributeSet attrs, int defStyleAttr) {
	super(context, attrs, defStyleAttr);

       scrollView = new HorizontalScrollView(context);
       scrollView.setOverScrollMode(HorizontalScrollView.OVER_SCROLL_NEVER);
       scrollView.setHorizontalScrollBarEnabled(false);
       layout = new LinearLayout(context);
       scrollView.addView(layout);

	// get attributes
	if(attrs != null) {
		TypedArray a = context.getTheme().obtainStyledAttributes(attrs,R.styleable.MaterialTabHost, 0, 0);
		
		try {
               // custom attributes
			hasIcons = a.getBoolean(R.styleable.MaterialTabHost_hasIcons, false);

               primaryColor = a.getColor(R.styleable.MaterialTabHost_materialTabsPrimaryColor, Color.parseColor("#009688"));
               accentColor = a.getColor(R.styleable.MaterialTabHost_accentColor,Color.parseColor("#00b0ff"));
               iconColor = a.getColor(R.styleable.MaterialTabHost_iconColor,Color.WHITE);
               textColor = a.getColor(R.styleable.MaterialTabHost_textColor,Color.WHITE);
		} finally {
			a.recycle();
		}
	}
	else {
		hasIcons = false;
	}

       this.isInEditMode();
       scrollable = false;
       isTablet = this.getResources().getBoolean(R.bool.isTablet);
       density = this.getResources().getDisplayMetrics().density;
       tabSelected = 0;

	// initialize tabs list
	tabs = new LinkedList<MaterialTab>();

       // set background color
       super.setBackgroundColor(primaryColor);
}