android.widget.TableRow.LayoutParams#android.widget.HorizontalScrollView源码实例Demo

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

源代码1 项目: RichEditorView   文件: LuBottomMenu.java
private void removeAllLevels(int num) {
    if (num >= mDisplayRowNum || num < 1) {
        return;
    }

    int b = mDisplayRowNum - num;
    for (int i = mDisplayRowNum - 1; i >= b; i--) {
        if (mDisplayMenus.get(i).getChildAt(0) instanceof HorizontalScrollView) {
            View v = ((HorizontalScrollView) mDisplayMenus.get(i).getChildAt(0)).getChildAt(0);
            if (v != null && v instanceof LinearLayout) {
                ((LinearLayout) v).removeAllViews();
            }
        }
        mDisplayMenus.get(i).removeAllViews();
        mDisplayMenus.remove(i);
        removeView(getChildAt(i));
        getBottomMenuItem(mPathRecord.peek()).setSelected(false);
        mPathRecord.pop();
        mDisplayRowNum--;
    }
}
 
@Override
public void addView(View child) {
    super.addView(child);
    if (child instanceof HorizontalScrollView) {
        child.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
            private int x = 0;
            @Override
            public void onScrollChanged() {
                if (child.getScrollX() < x) {
                    horizontalScrollViewScrolledListener.onScrolledLeft();
                } else {
                    horizontalScrollViewScrolledListener.onScrolledRight();
                }

                x = child.getScrollX();
            }
        });
    }
}
 
源代码3 项目: TurboLauncher   文件: WallpaperPickerActivity.java
private void initializeScrollForRtl() {
    final HorizontalScrollView scroll =
            (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container);

    if (scroll.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        final ViewTreeObserver observer = scroll.getViewTreeObserver();
        observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            public void onGlobalLayout() {
                LinearLayout masterWallpaperList =
                        (LinearLayout) findViewById(R.id.master_wallpaper_list);
                scroll.scrollTo(masterWallpaperList.getWidth(), 0);
                scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }
}
 
源代码4 项目: ViewCapture   文件: CaptureType.java
void of(T t) {
    Capture capture;
    if (t instanceof RecyclerView) {
        capture = new RecyclerViewCapture();
    } else if (t instanceof ListView) {
        capture = new ListViewCapture();
    } else if (t instanceof ScrollView) {
        capture = new ScrollViewCapture();
    } else if (t instanceof HorizontalScrollView) {
        capture = new HorizontalScrollViewCapture();
    } else if (t instanceof WebView) {
        capture = new WebViewCapture();
    } else if (t instanceof Activity) {
        capture = new WindowCapture();
    } else {
        capture = new DefaultViewCapture();
    }
    captureManager.into(t, capture);
}
 
源代码5 项目: Telegram   文件: AndroidUtilities.java
public static void setScrollViewEdgeEffectColor(HorizontalScrollView scrollView, int color) {
    if (Build.VERSION.SDK_INT >= 21) {
        try {
            Field field = HorizontalScrollView.class.getDeclaredField("mEdgeGlowLeft");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(scrollView);
            if (mEdgeGlowTop != null) {
                mEdgeGlowTop.setColor(color);
            }

            field = HorizontalScrollView.class.getDeclaredField("mEdgeGlowRight");
            field.setAccessible(true);
            EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(scrollView);
            if (mEdgeGlowBottom != null) {
                mEdgeGlowBottom.setColor(color);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
}
 
源代码6 项目: AndroidMathKeyboard   文件: KeyboardFragment.java
/**
 * 键盘左侧菜单
 */
private void menuKeyboard(Dialog dialog) {
    evLatexView = (EditView) dialog.findViewById(R.id.evLatexView);
    hsvLatex = (HorizontalScrollView) dialog.findViewById(R.id.hsvLatex);

    tvConfirm = (TextView) dialog.findViewById(R.id.tvConfirm);

    llMathKeyBoardLayout = (LinearLayout) dialog.findViewById(R.id.llMathKeyBoardLayout);
    llLatterKeyBoardLayout = (LinearLayout) dialog.findViewById(R.id.llLatterKeyBoardLayout);

    llDefaultLayout = (LinearLayout) dialog.findViewById(R.id.llDefaultLayout);
    tlAlgebraLayout = (LinearLayout) dialog.findViewById(R.id.tlAlgebraLayout);
    llGeometryLayout = (LinearLayout) dialog.findViewById(R.id.llGeometryLayout);

    tvDefault = (TextView) dialog.findViewById(R.id.tvDefault);
    tvAlgebra = (TextView) dialog.findViewById(R.id.tvAlgebra);
    tvGeometry = (TextView) dialog.findViewById(R.id.tvGeometry);
    tvLetter = (TextView) dialog.findViewById(R.id.tvLetter);

    tvConfirm.setOnClickListener(onClickListener);
    tvDefault.setOnClickListener(onClickListener);
    tvAlgebra.setOnClickListener(onClickListener);
    tvGeometry.setOnClickListener(onClickListener);
    tvLetter.setOnClickListener(onClickListener);
}
 
public void testScrollEvents() {
  HorizontalScrollView scrollView = getViewAtPath(0);

  dragLeft();

  waitForBridgeAndUIIdle();
  mScrollListenerModule.waitForScrollIdle();
  waitForBridgeAndUIIdle();

  ArrayList<Double> xOffsets = mScrollListenerModule.getXOffsets();
  assertFalse("Expected to receive at least one scroll event", xOffsets.isEmpty());
  assertTrue("Expected offset to be greater than 0", xOffsets.get(xOffsets.size() - 1) > 0);
  assertTrue(
      "Expected no item click event fired",
      mScrollListenerModule.getItemsPressed().isEmpty());
  assertEquals(
      "Expected last offset to be offset of scroll view",
      PixelUtil.toDIPFromPixel(scrollView.getScrollX()),
      xOffsets.get(xOffsets.size() - 1).doubleValue(),
      1e-5);
}
 
源代码8 项目: BigApp_WordPress_Android   文件: EditPage.java
private void initImageListView() {
	final HorizontalScrollView hScrollView = (HorizontalScrollView) findViewByResName("hScrollView");
	ImageListResultsCallback callback = new ImageListResultsCallback() {

		@Override
		public void onFinish(ArrayList<ImageInfo> results) {
			if(results == null)
				return;
			LinearLayout layout = (LinearLayout) findViewByResName("imagesLinearLayout");
			for(ImageInfo imageInfo : results) {
				if(imageInfo.bitmap == null)
					continue;
				layout.addView(makeImageItemView(imageInfo));
			}
		}
	};
	if(!initImageList(callback)) {
		hScrollView.setVisibility(View.GONE);
	}

}
 
public static boolean isScrollingView(View view) {
    if (ViewCatcherUtil.isViewPager(view)
            || view instanceof HorizontalScrollView
            || view instanceof WebView) {
        return true;
    } else if (ViewCatcherUtil.isRecyclerView(view)) {
        RecyclerView recyclerView = (RecyclerView) view;
        RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
        if (manager != null) {
            if (manager instanceof LinearLayoutManager) {
                LinearLayoutManager linearManager = ((LinearLayoutManager) manager);
                return linearManager.getOrientation() == RecyclerView.HORIZONTAL;
            } else if (manager instanceof StaggeredGridLayoutManager) {
                StaggeredGridLayoutManager gridLayoutManager =
                        (StaggeredGridLayoutManager) manager;
                return gridLayoutManager.getOrientation() == RecyclerView.HORIZONTAL;
            }
        }
    }
    return false;
}
 
源代码10 项目: HollyViewPager   文件: HollyViewPager.java
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    addView(LayoutInflater.from(getContext()).inflate(R.layout.holly_view_pager, this, false));

    viewPager = (ViewPager) findViewById(R.id.bfp_viewPager);
    headerScroll = (HorizontalScrollView) findViewById(R.id.bfp_headerScroll);
    headerLayout = (ViewGroup) findViewById(R.id.bfp_headerLayout);

    {
        ViewGroup.LayoutParams layoutParams = headerLayout.getLayoutParams();
        layoutParams.height = this.settings.headerHeightPx;
        headerLayout.setLayoutParams(layoutParams);
    }

    animator = new HollyViewPagerAnimator(this);
}
 
源代码11 项目: LB-Launcher   文件: WallpaperPickerActivity.java
private void initializeScrollForRtl() {
    final HorizontalScrollView scroll =
            (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container);

    if (scroll.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        final ViewTreeObserver observer = scroll.getViewTreeObserver();
        observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            public void onGlobalLayout() {
                LinearLayout masterWallpaperList =
                        (LinearLayout) findViewById(R.id.master_wallpaper_list);
                scroll.scrollTo(masterWallpaperList.getWidth(), 0);
                scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }
}
 
源代码12 项目: android_dbinspector   文件: TableFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.dbinspector_fragment_table, container, false);

    tableLayout = (TableLayout) view.findViewById(R.id.dbinspector_table_layout);
    previousButton = view.findViewById(R.id.dbinspector_button_previous);
    nextButton = view.findViewById(R.id.dbinspector_button_next);
    currentPageText = (TextView) view.findViewById(R.id.dbinspector_text_current_page);
    contentHeader = view.findViewById(R.id.dbinspector_layout_content_header);
    scrollView = (ScrollView) view.findViewById(R.id.dbinspector_scrollview_table);
    horizontalScrollView = (HorizontalScrollView) view.findViewById(R.id.dbinspector_horizontal_scrollview_table);

    previousButton.setOnClickListener(previousListener);
    nextButton.setOnClickListener(nextListener);

    return view;
}
 
源代码13 项目: BigApp_Discuz_Android   文件: EditPage.java
private void initImageListView() {
	final HorizontalScrollView hScrollView = (HorizontalScrollView) findViewByResName("hScrollView");
	ImageListResultsCallback callback = new ImageListResultsCallback() {

		@Override
		public void onFinish(ArrayList<ImageInfo> results) {
			if(results == null)
				return;
			LinearLayout layout = (LinearLayout) findViewByResName("imagesLinearLayout");
			for(ImageInfo imageInfo : results) {
				if(imageInfo.bitmap == null)
					continue;
				layout.addView(makeImageItemView(imageInfo));
			}
		}
	};
	if(!initImageList(callback)) {
		hScrollView.setVisibility(View.GONE);
	}

}
 
源代码14 项目: PixaToon   文件: FilterSelectorFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_filterselector, container, false);
    mFilterMap = new HashMap<>();
    initFilterMap();

    for(int filterBtnId : mFilterMap.keySet()) {
        View filterSelectBtn = view.findViewById(filterBtnId);
        filterSelectBtn.setOnClickListener(this);
        if(((MainActivity)getActivity()).getOrientation() == Configuration.ORIENTATION_LANDSCAPE)
            filterSelectBtn.setRotation(90);
    }

    mScrollBar = (HorizontalScrollView)view.findViewById(R.id.scrollBar);
    return view;
}
 
源代码15 项目: NIM_Android_UIKit   文件: EmoticonPickerView.java
protected void setupEmojView() {
    currentEmojiPage = (ViewPager) findViewById(R.id.scrPlugin);
    pageNumberLayout = (LinearLayout) findViewById(R.id.layout_scr_bottom);
    tabView = (LinearLayout) findViewById(R.id.emoj_tab_view);
    scrollView = (HorizontalScrollView) findViewById(R.id.emoj_tab_view_container);

    findViewById(R.id.top_divider_line).setVisibility(View.VISIBLE);
}
 
源代码16 项目: 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);
}
 
源代码17 项目: XCL-Charts   文件: HBARScrollActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_hbarscroll);
	
	this.setTitle("柱形图左右滑动");
	
	horiView = (HorizontalScrollView) findViewById(R.id.horizontalScrollView1);
	horiView.setPadding(70, 0, 0, 0);
	
	//设置horizontalScrollvView拉到头和尾的时候没有阴影颜色
	horiView.setOverScrollMode(View.OVER_SCROLL_NEVER);								
}
 
源代码18 项目: aurora-imui   文件: EmoticonsToolBarView.java
public EmoticonsToolBarView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mInflater.inflate(R.layout.view_emoticonstoolbar, this);
    this.mContext = context;
    mBtnWidth = (int) context.getResources().getDimension(R.dimen.bar_tool_btn_width);
    hsv_toolbar = (HorizontalScrollView) findViewById(R.id.hsv_toolbar);
    ly_tool = (LinearLayout) findViewById(R.id.ly_tool);
}
 
源代码19 项目: DevUtils   文件: ListViewUtils.java
/**
 * 滚动到指定位置 ( 有滚动过程 ) - 相对于初始位置移动
 * @param view {@link View}
 * @param x    X 轴开始坐标
 * @param y    Y 轴开始坐标
 * @param <T>  泛型
 * @return {@link View}
 */
public static <T extends View> T smoothScrollTo(final T view, final int x, final int y) {
    if (view != null) {
        if (view instanceof NestedScrollView) {
            ((NestedScrollView) view).smoothScrollTo(x, y);
        } else if (view instanceof ScrollView) {
            ((ScrollView) view).smoothScrollTo(x, y);
        } else if (view instanceof HorizontalScrollView) {
            ((HorizontalScrollView) view).smoothScrollTo(x, y);
        }
    }
    return view;
}
 
private void initView() {

        mActivity = (MainActivity) getActivity();
        mViewPageFragment = mActivity.getViewPageFragment();

        mLinearTopNavi = (LinearLayout) mView.findViewById(R.id.mLinearTopNavi);
        mTopNaviScroll = (HorizontalScrollView) mView.findViewById(R.id.mTopNaviScroll);
        mMenuOnclickListener = new BottomMenuOnclickListener(mCheckedList, mView, this, mAdapter);
        mCopyBottomBarListner = new CopyBottomBarListner();
        mMoveBottonBarListner = new MoveBottonBarListner();
        mBottomMenu = (FileListBottomOperatorMenu) mView.findViewById(R.id.mBottomMenu);
        mBottomToolBar = (FileListBottomToolBar) mView.findViewById(R.id.mBottomToolBar);
        mCopyBottomChooseBar = (CopyBottomChooseBar) mView.findViewById(R.id.mBottomChooseBar);
        mMoveBottomChooseBar = (MoveBottomChooseBar) mView.findViewById(R.id.mBottomMoveChooseBar);
        mNothingView = mView.findViewById(R.id.nothing);

        mListView = (SwipListView) mView.findViewById(R.id.fileList);
        mListView.setAdapter(mAdapter);

        mListView.setOnItemRemoveListener(this);
        mListView.setOnItemClickListener(this);
        ((MainActivity) getActivity()).setOnBackPressedListener(this);

        Intent intent = new Intent();
        intent.setAction(BIND_STRING);
        getActivity().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);

    }
 
public HorizontalScrollMenu(Context context, AttributeSet attrs,
		int defStyle)
{
	super(context, attrs, defStyle);
	// TODO Auto-generated constructor stub
	mContext = context;
	View v = LayoutInflater.from(context).inflate(
			R.layout.horizontal_scroll_menu, this, true);
	rg_items = (RadioGroup) v.findViewById(R.id.rg_items);
	vp_content = (MyViewPager) v.findViewById(R.id.vp_content);
	mColors = getResources().getColorStateList(
			R.drawable.selector_menu_item_text);
	hsv_menu = (HorizontalScrollView) v.findViewById(R.id.hsv_menu);
	mBackgroundResId = R.drawable.bg_rb_checked;
}
 
源代码22 项目: ShareSDKShareDifMsgDemo-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;
}
 
源代码23 项目: AndroidMathKeyboard   文件: ViewAssembleManager.java
private void moveCoordinate() {
    if (formulaViews.containsKey(LineView.class.getSimpleName())) {
        FormulaView lineView = formulaViews.get(LineView.class.getSimpleName());
        int[] location = new int[2];
        lineView.getLocationOnScreen(location);
        ViewGroup etView = getRootView();
        if (etView != null) {
            HorizontalScrollView hsvLatex = LateXConfig.getInstance().getHsvLatex();
            hsvLatex.scrollTo(location[0] + lineView.getWidth() + etView.getWidth(), location[1]);
        }
    }
}
 
public void testScrolling() {
  HorizontalScrollView scrollView = getViewAtPath(0);
  assertNotNull(scrollView);
  assertEquals(0, scrollView.getScrollX());

  dragLeft();

  assertTrue("Expected to scroll by at least 50 pixels", scrollView.getScrollX() >= 50);
}
 
源代码25 项目: PLDroidShortVideo   文件: BeautyControlView.java
private void initViewFaceShape() {
    mFaceShapeSelect = (HorizontalScrollView) findViewById(R.id.face_shape_select_block);

    mFaceShapeBeautyBoxGroup = (BeautyBoxGroup) findViewById(R.id.beauty_group_face_shape);
    mFaceShapeBeautyBoxGroup.setOnCheckedChangeListener(new BeautyBoxGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(BeautyBoxGroup group, int checkedId) {
            mCheckedId = checkedId;
            mFaceShapeLayout.setVisibility(GONE);
            mBeautySeekBar.setVisibility(INVISIBLE);
            if (checkedId == R.id.beauty_box_face_shape) {
                mFaceShapeLayout.setVisibility(VISIBLE);
                float faceShape = getValue(R.id.beauty_box_face_shape);
                updateFaceShapeCheckedLine(FACE_SHAPE_ID_LIST.get((int) faceShape));
                mFaceShapeRadioGroup.check(FACE_SHAPE_ID_LIST.get((int) faceShape));
            } else {
                seekToSeekBar(checkedId);
            }
            onChangeFaceBeautyLevel(checkedId);
        }
    });
    BeautyBox boxFaceShape = (BeautyBox) findViewById(R.id.beauty_box_face_shape);
    BeautyBox boxEyeEnlarge = (BeautyBox) findViewById(R.id.beauty_box_eye_enlarge);
    BeautyBox boxCheekThinning = (BeautyBox) findViewById(R.id.beauty_box_cheek_thinning);
    mBoxIntensityChin = (BeautyBox) findViewById(R.id.beauty_box_intensity_chin);
    mBoxIntensityForehead = (BeautyBox) findViewById(R.id.beauty_box_intensity_forehead);
    mBoxIntensityNose = (BeautyBox) findViewById(R.id.beauty_box_intensity_nose);
    mBoxIntensityMouth = (BeautyBox) findViewById(R.id.beauty_box_intensity_mouth);
}
 
源代码26 项目: Metronome-Android   文件: EmphasesLayout.java
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int width = ConversionUtils.getPixelsFromDp(40) * getChildCount(), height = getMeasuredHeight();
    setMeasuredDimension(width, height);

    HorizontalScrollView.LayoutParams layoutParams = (HorizontalScrollView.LayoutParams) getLayoutParams();
    if (layoutParams != null && getParent() != null && getParent() instanceof View) {
        if (((View) getParent()).getMeasuredWidth() > width)
            layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
        else layoutParams.gravity = GravityCompat.START;
        setLayoutParams(layoutParams);
    }
}
 
源代码27 项目: 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;
}
 
public static boolean scrollCompat(View view, float deltaY) {
    if (view instanceof WebView
            || view instanceof HorizontalScrollView
            || ViewCatcherUtil.isRecyclerView(view)) {
        view.scrollBy((int) deltaY, 0);
        return true;
    }
    return false;
}
 
源代码29 项目: MagicHeaderViewPager   文件: DemoActivity.java
/************************************************************
 ****                       Test code                    ****
 ************************************************************/

private void initCustomHeader() {
    if (WelcomeActivity.demoType != DemoConfig.DemoType.Pull_to_add_Magic_Header_Mixed_Complicated_header) {
        // Simply add a picture
        addRandomPic();
    } else {
        // Example: add a custom Layout

        View customLayout = LayoutInflater.from(this).inflate(R.layout.header_custom_layout, null);
        Button btn = ((Button) customLayout.findViewById(R.id.button));
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(DemoActivity.this, "btn Clicked", Toast.LENGTH_SHORT).show();
            }
        });
        mMagicHeaderViewPager.addHeaderView(customLayout);

        HorizontalScrollView sv = new HorizontalScrollView(this);
        LinearLayout ll = new LinearLayout(this);
        ll.setOrientation(LinearLayout.HORIZONTAL);
        for (int i = 5; i > 0; i--) {
            ImageView iv = new ImageView(this);
            iv.setScaleType(ImageView.ScaleType.FIT_XY);
            iv.setImageResource(RandomPic.getInstance().getPicResId());
            ll.addView(iv, new LinearLayout.LayoutParams(MagicHeaderUtils.getScreenWidth(this), (int) (MagicHeaderUtils.getScreenWidth(this)*.66f)));
        }
        sv.addView(ll, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        mMagicHeaderViewPager.addHeaderView(sv);
    }
}
 
源代码30 项目: open-rmbt   文件: QoSTestDetailPagerFragment.java
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState)
{
    super.onCreateView(inflater, container, savedInstanceState);
    
    View v = inflater.inflate(R.layout.result_tabhost_pager, container, false);
	tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
	tabHost.setup();
	tabHost.setOnTabChangedListener(this);
	
	for (int i = 0; i < pagerAdapter.getCount(); i++) {
		TabSpec tab = tabHost.newTabSpec(String.valueOf(i));
		//tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]);
		tab.setContent(android.R.id.tabcontent);
		    		    		
		View indicator = inflater.inflate(R.layout.tabhost_indicator, null);
		TextView title = (TextView) indicator.findViewById(android.R.id.title);
		title.setText(pagerAdapter.getPageTitle(i));
		tab.setIndicator(indicator);
		tabHost.addTab(tab);
	}

    viewPager = (ExtendedViewPager) v.findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    
    viewPager.setOnPageChangeListener(this);
    setCurrentPosition(0);

	scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview);
   	viewPager.setCurrentItem(initPageIndex);
	
    return v;
}