本文整理汇总了Java中android.widget.HorizontalScrollView.addView方法的典型用法代码示例。如果您正苦于以下问题:Java HorizontalScrollView.addView方法的具体用法?Java HorizontalScrollView.addView怎么用?Java HorizontalScrollView.addView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.HorizontalScrollView
的用法示例。
在下文中一共展示了HorizontalScrollView.addView方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NavitationScrollLayout
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
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: getPlatformList
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
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;
}
示例3: getPlatformList
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
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;
}
示例4: getPlatformList
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
private LinearLayout getPlatformList() {
LinearLayout llToolBar = new LinearLayout(getContext());
llToolBar.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
TextView tvShareTo = new TextView(getContext());
int resId = R.getStringRes(this.activity, "share_to");
if (resId > 0) {
tvShareTo.setText(resId);
}
tvShareTo.setTextColor(-3158065);
tvShareTo.setTextSize(1, 18.0f);
int dp_9 = R.dipToPx(getContext(), 9);
LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(-2, -2);
lpShareTo.gravity = 16;
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(-2, -2);
lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
sv.setLayoutParams(lpSv);
llToolBar.addView(sv);
this.llPlat = new LinearLayout(getContext());
this.llPlat.setLayoutParams(new FrameLayout.LayoutParams(-2, -1));
sv.addView(this.llPlat);
return llToolBar;
}
示例5: onFinishInflate
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mRootLayout = new HorizontalScrollView(getContext());
mRootLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
mParentLayout = new LinearLayout(getContext());
mParentLayout.setOrientation(LinearLayout.HORIZONTAL);
mScroller = new Scroller(mRootLayout.getContext(), new DecelerateInterpolator(1.2f));
mParentLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
mRootLayout.addView(mParentLayout);
addView(mRootLayout);
}
示例6: createSuccessView
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
protected View createSuccessView() {
View view = UIUtils.inflate(R.layout.activity_detail);
//第一部分
FrameLayout detail_info = (FrameLayout) view.findViewById(R.id.detail_info);
DetailInfoHolder holder = new DetailInfoHolder();
holder.setData(appInfo);
detail_info.addView(holder.getRootView());
//第二部分
FrameLayout detail_safe = (FrameLayout) view.findViewById(R.id.detail_safe);
DetailSafeHolder detailSafeHolder = new DetailSafeHolder();
detailSafeHolder.setData(appInfo);
detail_safe.addView(detailSafeHolder.getRootView());
//第三部分
HorizontalScrollView detail_scroll = (HorizontalScrollView) view.findViewById(R.id.detail_screen);
DetailScrollHolder detailScrollHolder = new DetailScrollHolder();
detailScrollHolder.setData(appInfo);
detail_scroll.addView(detailScrollHolder.getRootView());
//第四部分
FrameLayout detail_des = (FrameLayout) view.findViewById(R.id.detail_des);
DetailDesHolder detailDesHolder = new DetailDesHolder();
detailDesHolder.setData(appInfo);
detail_des.addView(detailDesHolder.getRootView());
//第五部分
FrameLayout detail_bottom = (FrameLayout) view.findViewById(R.id.bottom_layout);
detailBottomHolder = new DetailBottomHolder();
detailBottomHolder.setData(appInfo);
detail_bottom.addView(detailBottomHolder.getRootView());
detailBottomHolder.startObserver();
return view;
}
示例7: getPlatformList
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
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, "ssdk_oks_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;
}
示例8: initView
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
private void initView(Context context) {
mContext = context;
HorizontalScrollView hScrollView = new HorizontalScrollView(context);
mLinearLayout = new LinearLayout(context);
mLinearLayout.setOrientation(LinearLayout.VERTICAL);
hScrollView.addView(mLinearLayout);
addView(hScrollView);
mItemHeight = dip2px(50);
mPadding = dip2px(16);
}
示例9: populate
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
public void populate(List<NameValuePair> pairs) {
removeAllViews();
HorizontalScrollView scrollView = new HorizontalScrollView(this.getContext());
addView(scrollView);
RadioGroup rg = new RadioGroup(this.getContext());
rg.setOrientation(LinearLayout.HORIZONTAL);
rg.setOnCheckedChangeListener(customListener);
scrollView.addView(rg);
for (NameValuePair pair : pairs) {
CustomRadioButton radioButton = new CustomRadioButton(this.getContext());
radioButton.setText(pair.getName());
radioButton.setValue(pair.getValue());
rg.addView(radioButton);
}
}
示例10: FilePictureGallery
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
public FilePictureGallery(Context context, FormInputDef attribute, String ref, boolean dynamic, boolean sync) {
super(context, attribute, ref, dynamic, sync);
FAIMSApplication.getInstance().injectMembers(this);
HorizontalScrollView scrollView = new HorizontalScrollView(this.getContext());
galleriesLayout = new LinearLayout(this.getContext());
galleriesLayout.setOrientation(LinearLayout.HORIZONTAL);
galleriesLayout.setGravity(Gravity.BOTTOM);
scrollView.addView(galleriesLayout);
addView(scrollView);
cssManager.addCSS(this, "file-gallery");
reset();
}
示例11: initContentView
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
protected View initContentView(Context context, AttributeSet attrs, int defStyleAttr) {
ForumThreadViewStyle viewstyle = getForumThreadViewStyle();
if(viewstyle == null) {
viewstyle = new ForumThreadViewStyle();
}
if(viewstyle.idMenuTabHeight == null) {
viewstyle.idMenuTabHeight = ResHelper.getResId(context, "dimen", "bbs_menu_tab_height");
}
tabHeight = getResources().getDimensionPixelSize(viewstyle.idMenuTabHeight);
LinearLayout llContent = new LinearLayout(context, attrs, defStyleAttr);
llContent.setBackgroundColor(getResources().getColor(ResHelper.getColorRes(getContext(), "bbs_white")));
llContent.setOrientation(LinearLayout.VERTICAL);
hsvContent = new HorizontalScrollView(context);
if(viewstyle.idMenuTabBg == null) {
viewstyle.idMenuTabBg = ResHelper.getColorRes(context, "bbs_menu_tab_bg");
}
hsvContent.setBackgroundColor(context.getResources().getColor(viewstyle.idMenuTabBg));
hsvContent.setHorizontalScrollBarEnabled(false);
hsvContent.setFillViewport(true);
slidingTabStrip = new SlidingTabStrip(context);
initTabStrip();
hsvContent.addView(slidingTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, tabHeight);
llContent.addView(hsvContent, llp);
View divider = new View(context);
if(viewstyle.idMenuTabDividerColor == null) {
viewstyle.idMenuTabDividerColor = ResHelper.getColorRes(context, "bbs_divider");
}
divider.setBackgroundColor(context.getResources().getColor(viewstyle.idMenuTabDividerColor));
if(viewstyle.idMenuTabDividerHeight == null) {
viewstyle.idMenuTabDividerHeight = ResHelper.getResId(context, "dimen", "bbs_menu_tab_divider_height");
}
llp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
getResources().getDimensionPixelSize(viewstyle.idMenuTabDividerHeight));
llContent.addView(divider, llp);
viewPager = buildViewPager();
llp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0);
llp.weight = 1;
llContent.addView(viewPager, llp);
return llContent;
}
示例12: AbSlidingTabView
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
public AbSlidingTabView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
this.setOrientation(LinearLayout.VERTICAL);
this.setBackgroundColor(Color.rgb(255, 255, 255));
mTabScrollView = new HorizontalScrollView(context);
mTabScrollView.setHorizontalScrollBarEnabled(false);
mTabScrollView.setSmoothScrollingEnabled(true);
mTabLayout = new LinearLayout(context);
mTabLayout.setOrientation(LinearLayout.HORIZONTAL);
mTabLayout.setGravity(Gravity.CENTER);
// mTabLayout是内容宽度
mTabScrollView.addView(mTabLayout, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.FILL_PARENT));
this.addView(mTabScrollView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
// 内容的View的适配
mViewPager = new ViewPager(context);
// 手动创建的ViewPager,必须调用setId()方法设置一个id
mViewPager.setId(1985);
pagerItemList = new Vector<Fragment>();
// 定义Tab栏
tabItemList = new Vector<TextView>();
tabItemTextList = new Vector<String>();
tabItemDrawableList = new Vector<Drawable>();
// 要求必须是FragmentActivity的实例
if (!(this.context instanceof FragmentActivity)) {
Log4jLog.e(LONG_TAG, "构造AbSlidingTabView的参数context,必须是FragmentActivity的实例。");
}
FragmentManager mFragmentManager = ((FragmentActivity) this.context)
.getSupportFragmentManager();
mFragmentPagerAdapter = new AbFragmentPagerAdapter(mFragmentManager,
pagerItemList);
mViewPager.setAdapter(mFragmentPagerAdapter);
mViewPager.setOnPageChangeListener(new MyOnPageChangeListener());
mViewPager.setOffscreenPageLimit(3);
this.addView(mViewPager, new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
示例13: createToolLayout
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
private void createToolLayout() {
buttonsScroll = new HorizontalScrollView(getContext());
addView(buttonsScroll);
buttonsLayout = new LinearLayout(getContext());
buttonsLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
buttonsLayout.setOrientation(LinearLayout.HORIZONTAL);
buttonsLayout.setGravity(Gravity.CENTER_VERTICAL);
buttonsScroll.addView(buttonsLayout);
List<MapTool> tools = mapView.getTools();
toolMap = new HashMap<String, MapTool>();
toolButtonMap = new HashMap<ToolBarButton, String>();
for (MapTool tool : tools) {
toolMap.put(tool.toString(), tool);
}
toolButtons = new ArrayList<ToolBarButton>();
toolGroups = new ArrayList<View>();
// create tool groups
createSelectGroup();
createCreateGroup();
createMeasureGroup();
createSelectionGroup();
// adding tool buttons as single group buttons
ToolBarButton followButton = toolMap.get(FollowTool.NAME).getButton(getContext());
toolButtons.add(followButton);
toolButtonMap.put(followButton, FollowTool.NAME);
toolGroups.add(followButton);
loadButton = toolMap.get(LoadTool.NAME).getButton(getContext());
loadButton.setVisibility(View.GONE);
toolButtons.add(loadButton);
toolButtonMap.put(loadButton, LoadTool.NAME);
toolGroups.add(loadButton);
// wrap groups as radio buttons
for (ToolBarButton button : toolButtons) {
wrapAsRadioButton(button);
}
// set anchor for groups
for (View view : toolGroups) {
if (view instanceof ToolGroupButton) {
((ToolGroupButton) view).setAnchorView(buttonsLayout);
}
}
configButton = new ToolBarButton(getContext());
configButton.setLabel("Config");
configButton.setSelectedState(R.drawable.style_button);
configButton.setNormalState(R.drawable.style_button);
configButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showConfigDialog();
}
});
refreshLayout();
// select first button
setSelectedButton(toolButtons.get(0));
}
示例14: init
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
private void init(){
/**
* LEFT VIEWS
*/
mLeftFirstLevelLinear = new LinearLayout(this.getContext());
mLeftFirstLevelLinear.setOrientation(LinearLayout.VERTICAL);
mLeftSecondLevelHeaderLinear = new LinearLayout(this.getContext());
mLeftSecondLevelHeaderLinear.setOrientation(LinearLayout.HORIZONTAL);
mLeftSecondLevelBodyScrollView = new CustomScrollView(this);
mLeftSecondLevelBodyScrollView.setTag(SCROLLVIEW_TAGS.LEFT_TABLE_SCROLLVIEW);
mLeftThirdLevelBodyLinear = new LinearLayout(this.getContext());
mLeftThirdLevelBodyLinear.setOrientation(LinearLayout.VERTICAL);
mLeftFirstLevelLinear.addView(mLeftSecondLevelHeaderLinear);
mLeftFirstLevelLinear.addView(mLeftSecondLevelBodyScrollView);
mLeftSecondLevelBodyScrollView.addView(mLeftThirdLevelBodyLinear);
/**
* RIGHT VIEWS
*/
mRightFirstLevelHorizontalScrollView = new HorizontalScrollView(this.getContext());
mRightSecondLevelLinear = new LinearLayout(this.getContext());
mRightSecondLevelLinear.setOrientation(LinearLayout.VERTICAL);
mRightFirstLevelHorizontalScrollView.addView(mRightSecondLevelLinear);
mRightThirdLevelHeaderLinear = new LinearLayout(this.getContext());
mRightThirdLevelHeaderLinear.setOrientation(LinearLayout.HORIZONTAL);
mRightThirdLevelBodyScrollView = new CustomScrollView(this);
mRightThirdLevelBodyScrollView.setTag(SCROLLVIEW_TAGS.RIGHT_TABLE_SCROLLVIEW);
mRightSecondLevelLinear.addView(mRightThirdLevelHeaderLinear);
mRightSecondLevelLinear.addView(mRightThirdLevelBodyScrollView);
mRightFourthLevelBodyLinear = new LinearLayout(this.getContext());
mRightFourthLevelBodyLinear.setOrientation(LinearLayout.VERTICAL);
mRightThirdLevelBodyScrollView.addView(mRightFourthLevelBodyLinear);
addView(mLeftFirstLevelLinear);
addView(mRightFirstLevelHorizontalScrollView);
}