类android.widget.ScrollView源码实例Demo

下面列出了怎么用android.widget.ScrollView的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: codeexamples-android   文件: FragmentLayout.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    if (container == null) {
        // We have different layouts, and in one of them this
        // fragment's containing frame doesn't exist.  The fragment
        // may still be created from its saved state, but there is
        // no reason to try to create its view hierarchy because it
        // won't be displayed.  Note this is not needed -- we could
        // just run the code below, where we would create and return
        // the view hierarchy; it would just never be used.
        return null;
    }

    ScrollView scroller = new ScrollView(getActivity());
    TextView text = new TextView(getActivity());
    int padding = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            4, getActivity().getResources().getDisplayMetrics());
    text.setPadding(padding, padding, padding, padding);
    scroller.addView(text);
    text.setText(Shakespeare.DIALOGUE[getShownIndex()]);
    return scroller;
}
 
源代码2 项目: weex   文件: WXRenderStatement.java
/**
 * create RootView ,every weex Instance View has a rootView;
 * @see com.taobao.weex.dom.WXDomStatement#createBody(JSONObject)
 */
void createBody(WXComponent component) {
  long start = System.currentTimeMillis();
  component.createView(mGodComponent, -1);
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
  }
  start = System.currentTimeMillis();
  component.applyLayoutAndEvent(component);
  component.bindData(component);

  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
  }

  if (component instanceof WXScroller) {
    WXScroller scroller = (WXScroller) component;
    if (scroller.getView() instanceof ScrollView) {
      mWXSDKInstance.setRootScrollView((ScrollView) scroller.getView());
    }
  }
  mWXSDKInstance.setRootView(mGodComponent.getRealView());
  if (mWXSDKInstance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
    mWXSDKInstance.onViewCreated(mGodComponent);
  }
}
 
源代码3 项目: DialogUtil   文件: IosAlertDialogHolder.java
@Override
protected void findViews() {
    tvTitle = (TextView) rootView.findViewById(R.id.tv_title);
    tvMsg = (TextView) rootView.findViewById(R.id.tv_msg);
    et1 = (EditText) rootView.findViewById(R.id.et_1);
    et2 = (EditText) rootView.findViewById(R.id.et_2);
    line = (View) rootView.findViewById(R.id.line);
    btn1 = (Button) rootView.findViewById(R.id.btn_1);
    lineBtn2 = (View) rootView.findViewById(R.id.line_btn2);
    btn2 = (Button) rootView.findViewById(R.id.btn_2);
    lineBtn3 = (View) rootView.findViewById(R.id.line_btn3);
    btn3 = (Button) rootView.findViewById(R.id.btn_3);
    llContainerHorizontal = (LinearLayout) rootView.findViewById(R.id.ll_container_horizontal);
    btn1Vertical = (Button) rootView.findViewById(R.id.btn_1_vertical);
    lineBtn2Vertical = (View) rootView.findViewById(R.id.line_btn2_vertical);
    btn2Vertical = (Button) rootView.findViewById(R.id.btn_2_vertical);
    lineBtn3Vertical = (View) rootView.findViewById(R.id.line_btn3_vertical);
    btn3Vertical = (Button) rootView.findViewById(R.id.btn_3_vertical);
    llContainerVertical = (LinearLayout) rootView.findViewById(R.id.ll_container_vertical);
    sv = (ScrollView) rootView.findViewById(R.id.sv);
    llContainerContent = (LinearLayout) rootView.findViewById(R.id.ll_container);
}
 
源代码4 项目: sensors-samples   文件: CardStreamLinearLayout.java
private void scrollToCard(String tag) {


        final int count = getChildCount();
        for (int index = 0; index < count; ++index) {
            View child = getChildAt(index);

            if (tag.equals(child.getTag())) {

                ViewParent parent = getParent();
                if( parent != null && parent instanceof ScrollView ){
                    ((ScrollView)parent).smoothScrollTo(
                            0, child.getTop() - getPaddingTop() - child.getPaddingTop());
                }
                return;
            }
        }
    }
 
源代码5 项目: BottomDialog   文件: BottomDialog.java
public CustomDialog(Context context) {
    super(context);
    items = new ArrayList<>();
    icon = getContext().getResources().getDimensionPixelSize(R.dimen.dimen_32_dp);
    padding = getContext().getResources().getDimensionPixelSize(R.dimen.dimen_8_dp);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    container = new LinearLayout(getContext());
    container.setLayoutParams(params);
    container.setBackgroundColor(Color.WHITE);
    container.setOrientation(LinearLayout.VERTICAL);
    container.setPadding(0, padding, 0, padding);
    ScrollView scrollView = new ScrollView(getContext());
    scrollView.addView(container);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(scrollView, params);
    setCancelable(true);
    setCanceledOnTouchOutside(true);
    getWindow().setGravity(Gravity.BOTTOM);
    getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
    getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
}
 
源代码6 项目: APDE   文件: SketchFile.java
protected void updateEditor(EditorActivity context) {
	final CodeEditText code = fragment.getCodeEditText();
	final HorizontalScrollView scrollerX = fragment.getCodeScrollerX();
	final ScrollView scrollerY = fragment.getCodeScroller();
	
	//Update the code area text
	code.setNoUndoText(getText());
	//Update the code area selection
	code.setSelection(getSelectionStart(), getSelectionEnd());
	
	code.post(code::updateBracketMatch);
	
	scrollerX.post(() -> scrollerX.scrollTo(getScrollX(), 0));
	
	scrollerY.post(() -> scrollerY.scrollTo(0, getScrollY()));
	
	context.supportInvalidateOptionsMenu();
}
 
源代码7 项目: AndroidStudyDemo   文件: ConvertToBitmapUtil.java
/**
 * 将ScrollView转换为Bitmap
 * @param scrollView
 * @return
 */
public static Bitmap convertScrollViewToBitmap(ScrollView scrollView) {
    int h = 0;
    Bitmap bitmap = null;
    // 获取scrollview实际高度
    for (int i = 0; i < scrollView.getChildCount(); i++) {
        h += scrollView.getChildAt(i).getHeight();
        scrollView.getChildAt(i).setBackgroundColor(
                Color.parseColor("#ffffff"));
    }
    // 创建对应大小的bitmap
    bitmap = Bitmap.createBitmap(scrollView.getWidth(), h,
            Bitmap.Config.RGB_565);
    final Canvas canvas = new Canvas(bitmap);
    scrollView.draw(canvas);
    return bitmap;
}
 
源代码8 项目: SublimePicker   文件: SublimeRecurrencePicker.java
public void updateView() {
    if (mCurrentView == CurrentView.RECURRENCE_OPTIONS_MENU) {
        mRecurrenceOptionCreator.setVisibility(View.GONE);
        llRecurrenceOptionsMenu.setVisibility(View.VISIBLE);

        // Current repeat option may have changed
        updateFlowLayout(mCurrentRecurrenceOption);

        // reset `scrollY` to 0
        final ScrollView scrollView
                = (ScrollView) llRecurrenceOptionsMenu.findViewById(R.id.svRecurrenceOptionsMenu);
        llRecurrenceOptionsMenu.post(new Runnable() {
            @Override
            public void run() {
                if (scrollView.getScrollY() != 0)
                    scrollView.fullScroll(ScrollView.FOCUS_UP);
            }
        });
    } else if (mCurrentView == CurrentView.RECURRENCE_CREATOR) {
        llRecurrenceOptionsMenu.setVisibility(View.GONE);
        mRecurrenceOptionCreator.setVisibility(View.VISIBLE);
    }
}
 
源代码9 项目: DraggedViewPager   文件: MDA_DraggedViewPager.java
@SuppressWarnings("unchecked")
public void notifyDataSetChanged() {
    int currentPageIndex = currentPage;

    container.removeAllViews();

    for (int i = 0; i < controller.getData().size(); i++) {
        View pageView = LayoutInflater.from(getContext()).inflate(controller.getPageLayoutRes(), container, false);
        //添加至主框架View
        container.addView(pageView);
        ScrollView scrollView = (ScrollView) pageView.findViewById(R.id.dvp_scroll_view);
        MDA_PageListLayout pageListLayout = new MDA_PageListLayout(getContext(), controller.getItemLayoutRes());
        //添加View
        scrollView.addView(pageListLayout);
        //设置页面索引
        pageListLayout.setPageIndex(i);
        controller.bindPageData(pageView, i);
        //设置数据
        pageListLayout.setData(controller.getPage(i).getData());
    }

    initDragEvent(DragUtils.DragViewType.ALL);

    scrollToPage(currentPageIndex);
}
 
源代码10 项目: BlurView   文件: BlurDrawableActivity.java
private void init() {
    mBlurDrawableRelativeLayout = (RelativeLayout) this.findViewById(R.id.blur_drawable_container);
    mBlurDrawableRelativeLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            mBlurDrawableRelativeLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            mBlurDrawable = new BlurDrawable(BlurDrawableActivity.this);
            mBlurDrawable.drawableContainerId(R.id.blur_drawable_container)
                    .cornerRadius(10)
                    .blurRadius(10)
                    .overlayColor(Color.parseColor("#64ffffff"))
                    .offset(mBlurDrawableRelativeLayout.getLeft(), mBlurDrawableRelativeLayout.getTop() );
            mBlurDrawableRelativeLayout.setBackgroundDrawable(mBlurDrawable);
        }
    });

    mScrollView = (ScrollView) this.findViewById(R.id.sv);
    mScrollView.getViewTreeObserver().addOnScrollChangedListener(getOnScrollChangedListener());
}
 
源代码11 项目: DanDanPlayForAndroid   文件: ScrollableHelper.java
@SuppressLint("NewApi")
public void smoothScrollBy(int velocityY, int distance, int duration) {
    View scrollableView = getScrollableView();
    if (scrollableView instanceof AbsListView) {
        AbsListView absListView = (AbsListView) scrollableView;
        if (Build.VERSION.SDK_INT >= 21) {
            absListView.fling(velocityY);
        } else {
            absListView.smoothScrollBy(distance, duration);
        }
    } else if (scrollableView instanceof ScrollView) {
        ((ScrollView) scrollableView).fling(velocityY);
    }  else if (scrollableView instanceof NestedScrollView) {
        ((NestedScrollView) scrollableView).fling(velocityY);
    } else if (scrollableView instanceof RecyclerView) {
        ((RecyclerView) scrollableView).fling(0, velocityY);
    } else if (scrollableView instanceof WebView) {
        ((WebView) scrollableView).flingScroll(0, velocityY);
    }
}
 
源代码12 项目: Locate-driver   文件: MainActivity.java
private void scrollTop() {
    final ScrollView scrollView = (ScrollView) this.findViewById(R.id.scrollview);

    scrollView.post(new Runnable() {
        public void run() {
            scrollView.scrollTo(0, 0);
        }
    });
}
 
源代码13 项目: cwac-mediarouter   文件: PlaybackFragment.java
@Override
public View onCreateView(LayoutInflater inflater,
                         ViewGroup container,
                         Bundle savedInstanceState) {
  scroll=
      (ScrollView)inflater.inflate(R.layout.activity_main, container,
                                   false);

  transcript=(TextView)scroll.findViewById(R.id.transcript);

  logToTranscript("Started");

  return(scroll);
}
 
源代码14 项目: media-samples   文件: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}
 
源代码15 项目: xDrip   文件: UpdateActivity.java
public void downloadNow(View myview) {
    if (DOWNLOAD_URL.length() > 0) {
        if (prefs.getBoolean(useInternalDownloaderPrefsName, true)) {
            if (checkPermissions()) {
                if (downloading) {
                    JoH.static_toast_long(this, "Already downloading!");
                } else {
                    downloading = true;
                    JoH.static_toast_long(this, "Attempting background download...");
                    mScrollView.post(new Runnable() {
                        public void run() {
                            mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
                        }
                    });
                    new AsyncDownloader().executeOnExecutor(xdrip.executor);

                }
            } else {
                JoH.static_toast_long(this, "Need permission to download file");
            }
        } else {
            viewIntentDownload(DOWNLOAD_URL);
            finish();
        }

    } else {
        Log.e(TAG, "Download button pressed but no download URL");
    }
}
 
源代码16 项目: Focus   文件: PostDetailFragment.java
private void initView(){

        layers = new int[]{
                R.id.header_container,
                R.id.post_content,
        };

        //根据偏好设置的背景颜色,设置标题栏位置的背景颜色
        if (!SkinPreference.getInstance().getSkinName().equals("night")){
//            helper.setBackgroundColor(R.id.container, PostSetting.getBackgroundInt(context));
            postTitle.setBackgroundColor(PostSetting.getBackgroundInt(getContext()));
            postTurn.setBackgroundColor(PostSetting.getBackgroundInt(getContext()));
        }

        //设置文章内容
        PostUtil.setContent(getContext(), feedItem, postContent,null);
        postTitle.setText(feedItem.getTitle());
        postTime.setText( DateUtil.getTimeStringByInt(feedItem.getDate()));
        feedName.setText( feedItem.getFeedName());

        if (!feedItem.isRead()) {
            //如果这个文章没有阅读过则滚动到顶部
            postTurn.fullScroll(ScrollView.FOCUS_UP);
        }


        initListener();
    }
 
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}
 
源代码18 项目: MyBlogDemo   文件: NestedScrollView.java
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    final NestedScrollView nsvHost = (NestedScrollView) host;
    event.setClassName(ScrollView.class.getName());
    final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
    final boolean scrollable = nsvHost.getScrollRange() > 0;
    record.setScrollable(scrollable);
    record.setScrollX(nsvHost.getScrollX());
    record.setScrollY(nsvHost.getScrollY());
    record.setMaxScrollX(nsvHost.getScrollX());
    record.setMaxScrollY(nsvHost.getScrollRange());
}
 
private void autoMoveToBottom() {
    mTopNaviScroll.post(new Runnable() {
        @Override
        public void run() {
            mTopNaviScroll.fullScroll(ScrollView.FOCUS_RIGHT);
        }
    });
}
 
源代码20 项目: android-SlidingTabsColors   文件: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}
 
源代码21 项目: RedReader   文件: CommentEditActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {

	PrefsUtility.applyTheme(this);

	super.onCreate(savedInstanceState);

	if (getIntent() != null && getIntent().hasExtra("isSelfPost")
			&& getIntent().getBooleanExtra("isSelfPost", false)){
		setTitle(R.string.edit_post_actionbar);
		isSelfPost = true;
	} else {
		setTitle(R.string.edit_comment_actionbar);
	}
	textEdit = (EditText) getLayoutInflater().inflate(R.layout.comment_edit, null);

	if(getIntent() != null && getIntent().hasExtra("commentIdAndType")) {
		commentIdAndType = getIntent().getStringExtra("commentIdAndType");
		textEdit.setText(getIntent().getStringExtra("commentText"));

	} else if(savedInstanceState != null && savedInstanceState.containsKey("commentIdAndType")) {
		textEdit.setText(savedInstanceState.getString("commentText"));
		commentIdAndType = savedInstanceState.getString("commentIdAndType");
	}

	final ScrollView sv = new ScrollView(this);
	sv.addView(textEdit);
	setBaseActivityContentView(sv);
}
 
源代码22 项目: support   文件: LargeHeightImageDisplayFragment.java
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    ScrollView scrollView = new ScrollView(getActivity());
    scrollView.setBackgroundColor(Color.WHITE);
    scrollView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LinearLayout linearLayout = new LinearLayout(getActivity());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mContainer = linearLayout;
    scrollView.addView(linearLayout);
    return scrollView;
}
 
源代码23 项目: android-chromium   文件: CertificateViewer.java
private void showDialogForView(View view) {
    Dialog dialog = new Dialog(mContext);
    dialog.setTitle(R.string.certtitle);
    ScrollView scrollView = new ScrollView(mContext);
    scrollView.addView(view);
    dialog.addContentView(scrollView,
            new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.MATCH_PARENT));
    dialog.show();
}
 
源代码24 项目: sana.mobile   文件: MultiSelectElement.java
/**
 * {@inheritDoc}
 */
@Override
protected View createView(Context c) {
    ScrollView sv = new ScrollView(c);
    LinearLayout ll = new LinearLayout(c);
    HashSet<String> selectedSet = new HashSet<String>();

    if (answer == null)
        answer = "";
    // we've got a problem if there are TOKEN_DELIMITERs in the value!
    // since getAnswer separates responses using TOKEN_DELIMITER
    String[] values = answer.split(TOKEN_DELIMITER);
    for (String val : values) {
        selectedSet.add(val);
    }

    ll.setOrientation(LinearLayout.VERTICAL);
    cblist = new ArrayList<CheckBox>();
    for (String choice : labels()) {
        CheckBox cb = new CheckBox(c);
        cb.setTag(getValueFromLabel(choice));
        cb.setText(choice);
        cb.setChecked(selectedSet.contains(String.valueOf(cb.getTag())));
        cblist.add(cb);
        ll.addView(cb);
    }
    sv.addView(ll, new ViewGroup.LayoutParams(-1, -1));
    return encapsulateQuestion(c, sv);
}
 
源代码25 项目: overscroll-decor   文件: ScrollViewDemoFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View fragmentView = inflater.inflate(R.layout.scrollview_overscroll_demo, null, false);
    initHorizontalScrollView((HorizontalScrollView) fragmentView.findViewById(R.id.horizontal_scroll_view));
    initVerticalScrollView((ScrollView) fragmentView.findViewById(R.id.vertical_scroll_view));
    return fragmentView;
}
 
源代码26 项目: YTPlayer   文件: ErrorActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_error);

    setTitle("Send Report");

    sendLogs = findViewById(R.id.sendLogs);
    crashLayout = findViewById(R.id.crashLayout);
    editText = findViewById(R.id.reportText);

    crashDetails =  CustomActivityOnCrash.getStackTraceFromIntent(getIntent());

    crashLayout.setOnClickListener(v -> {
        ScrollView nestedScrollView = new ScrollView(this);
        TextView textView = new TextView(ErrorActivity.this);
        textView.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        textView.setPadding(20,20,20,20);
        textView.setTextSize(13);
        textView.setText(crashDetails);
        nestedScrollView.addView(textView);
        final AlertDialog.Builder alert= new AlertDialog.Builder(ErrorActivity.this);
        alert.setTitle("Stack Trace");
        alert.setView(nestedScrollView);
        alert.setPositiveButton("OK", null);
        alert.show();
    });
}
 
源代码27 项目: mConference-Framework   文件: Venue.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_venue, container,
            false);
    MapsInitializer.initialize(getActivity().getApplicationContext());
    scrollView = (ScrollView) v.findViewById(R.id.venue_scrollview);
    mMapView = (VenueMapView) v.findViewById(R.id.mapView);
    TextView address = (TextView) v.findViewById(R.id.venue_detail);

    sharedPref = getActivity().getApplicationContext()
            .getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_PRIVATE);
    venueAddress = sharedPref.getString(VENUE_TAG, null);
    address.setText(venueAddress);
    mMapView.onCreate(savedInstanceState);

    mMapView.onResume();// needed to get the map to display immediately

    status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity().getApplicationContext());

    googleMap = mMapView.getMap();

    new MapPlotting().execute();

    return v;
}
 
源代码28 项目: TelePlus-Android   文件: LayoutHelper.java
public static ScrollView.LayoutParams createScroll(int width, int height, int gravity, float leftMargin, float topMargin, float rightMargin, float bottomMargin) {
    ScrollView.LayoutParams layoutParams = new ScrollView.LayoutParams(getSize(width), getSize(height), gravity);
    layoutParams.leftMargin = AndroidUtilities.dp(leftMargin);
    layoutParams.topMargin = AndroidUtilities.dp(topMargin);
    layoutParams.rightMargin = AndroidUtilities.dp(rightMargin);
    layoutParams.bottomMargin = AndroidUtilities.dp(bottomMargin);
    return layoutParams;
}
 
源代码29 项目: letv   文件: PullToRefreshScrollView.java
protected boolean isReadyForPullEnd() {
    View scrollViewChild = ((ScrollView) this.mRefreshableView).getChildAt(0);
    if (scrollViewChild == null) {
        return false;
    }
    if (((ScrollView) this.mRefreshableView).getScrollY() >= scrollViewChild.getHeight() - getHeight()) {
        return true;
    }
    return false;
}
 
源代码30 项目: android-BasicNetworking   文件: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}
 
 类所在包
 同包方法