當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollView類代碼示例

本文整理匯總了Java中android.widget.ScrollView的典型用法代碼示例。如果您正苦於以下問題:Java ScrollView類的具體用法?Java ScrollView怎麽用?Java ScrollView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScrollView類屬於android.widget包,在下文中一共展示了ScrollView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: scrollToBottom

import android.widget.ScrollView; //導入依賴的package包/類
public static void scrollToBottom(final ScrollView scroll, final View inner) {

        Handler mHandler = new Handler();

        mHandler.post(new Runnable() {
            public void run() {
                if (scroll == null || inner == null) {
                    return;
                }

                int offset = inner.getMeasuredHeight() - scroll.getHeight();
                if (offset < 0) {
                    offset = 0;
                }

                scroll.smoothScrollTo(0, offset);
            }
        });
    }
 
開發者ID:FallenCrood,項目名稱:Review-,代碼行數:20,代碼來源:FavActivity.java

示例2: canChildPullUp

import android.widget.ScrollView; //導入依賴的package包/類
public boolean canChildPullUp() {
    if (child instanceof AbsListView) {
        AbsListView absListView = (AbsListView) child;
        return canScrollVertically(child, 1)
                || absListView.getLastVisiblePosition() != mTotalItemCount - 1;
    } else if (child instanceof WebView) {
        WebView webview = (WebView) child;
        if (webview instanceof XWebView) {
            return !((XWebView) webview).isBottom();
        } else {
            float left = webview.getContentHeight() * webview.getScale();
            int right = webview.getHeight() + webview.getScrollY();
            return left != right;
        }
    } else if (child instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) child;
        View childView = scrollView.getChildAt(0);
        if (childView != null) {
            return canScrollVertically(child, 1)
                    || scrollView.getScrollY() < childView.getHeight() - scrollView.getHeight();
        }
    } else {
        return canScrollVertically(child, 1);
    }
    return true;
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:27,代碼來源:XRefreshContentView.java

示例3: optionTutorial

import android.widget.ScrollView; //導入依賴的package包/類
private void optionTutorial() {
	((ScrollView) findViewById(R.id.svTutorialHeader)).setVisibility(View.VISIBLE);
	((ScrollView) findViewById(R.id.svTutorialDetails)).setVisibility(View.VISIBLE);
	int userId = Util.getUserId(Process.myUid());
	PrivacyManager.setSetting(userId, PrivacyManager.cSettingTutorialMain, Boolean.FALSE.toString());

	Dialog dlgUsage = new Dialog(this);
	dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON);
	dlgUsage.setTitle(R.string.title_usage_header);
	dlgUsage.setContentView(R.layout.usage);
	dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
	dlgUsage.setCancelable(true);
	dlgUsage.show();
}
 
開發者ID:ukanth,項目名稱:XPrivacy,代碼行數:15,代碼來源:ActivityMain.java

示例4: getViews

import android.widget.ScrollView; //導入依賴的package包/類
@Override
public void getViews() {
    mInflater = LayoutInflater.from(context);
    mCustomWebView = (CustomWebView) findViewById(R.id.webview_custom);
    back = (ImageView) findViewById(R.id.back);
    toleft_iv_right = (ImageView) findViewById(R.id.toleft_iv_right);
    recommend_listview = (ListView) findViewById(R.id.recommend_listview);
    shareWeixinIV = (ImageView) findViewById(R.id.share_weixin);
    shareFriendsIV = (ImageView) findViewById(R.id.share_friends);
    shareQqIV = (ImageView) findViewById(R.id.share_qq);
    shareWeiboIV = (ImageView) findViewById(R.id.share_weibo);
    recommend_layout = (LinearLayout)findViewById(R.id.recommend_layout);
    share = (ImageView) findViewById(R.id.share);
    mProgressLayout = (ProgressBarView) findViewById(R.id.pbv_loading);
    allProgressLayuot = (ProgressBarView) findViewById(R.id.all_pbv_loading);
    share_layout = (LinearLayout)findViewById(R.id.share_layout);
    info = (ScrollView) findViewById(R.id.info);
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:19,代碼來源:SubjectActivity.java

示例5: initView

import android.widget.ScrollView; //導入依賴的package包/類
private void initView() {
    weatherLayout = (ScrollView)findViewById(R.id.weather_layout);
    titleCity = (TextView)findViewById(R.id.title_city);
    titleUpdateTime = (TextView)findViewById(R.id.title_update_time);
    degreeText = (TextView)findViewById(R.id.degree_text);
    weatherInfoText = (TextView)findViewById(R.id.weather_info_text);
    forecastLayout = (LinearLayout)findViewById(R.id.forecast_layout);
    aqiText = (TextView)findViewById(R.id.aqi_text);
    pm25Text = (TextView)findViewById(R.id.pm25_text);
    comfortText = (TextView)findViewById(R.id.comfort_text);
    carWashText = (TextView)findViewById(R.id.car_wash_text);
    sportText = (TextView)findViewById(R.id.sport_text);
    bingPicImg = (ImageView)findViewById(R.id.bing_pic);
    swipeRefresh = (SwipeRefreshLayout)findViewById(R.id.swipe_refresh);
    drawerlayout = (DrawerLayout)findViewById(R.id.drawer_layout);
    navButton = (Button)findViewById(R.id.nav_button);
}
 
開發者ID:fczdev,項目名稱:nowweather,代碼行數:18,代碼來源:WeatherActivity.java

示例6: onImageUploaded

import android.widget.ScrollView; //導入依賴的package包/類
@Override
public void onImageUploaded(final String tweet) {
    // TODO Auto-generated method stub
    uiHandler.removeCallbacksAndMessages(null);
    uiHandler.post(new Runnable() {

        @Override
        public void run() {
            if (canChangeUI()) {
                OneSheeldTextView tweetItem = (OneSheeldTextView) activity
                        .getLayoutInflater().inflate(
                                R.layout.tweet_item,
                                lastTweetTextContainer, false);
                tweetItem.setText(tweet);
                lastTweetTextContainer.addView(tweetItem);
                ((ScrollView) lastTweetTextContainer.getParent())
                        .invalidate();
            }
        }
    });
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:22,代碼來源:TwitterFragment.java

示例7: onBuildContent

import android.widget.ScrollView; //導入依賴的package包/類
@Override
public View onBuildContent(QMUIDialog dialog, ScrollView parent) {
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    int padding = QMUIDisplayHelper.dp2px(mContext, 20);
    layout.setPadding(padding, padding, padding, padding);
    mEditText = new EditText(mContext);
    QMUIViewHelper.setBackgroundKeepingPadding(mEditText, QMUIResHelper.getAttrDrawable(mContext, R.attr.qmui_list_item_bg_with_border_bottom));
    mEditText.setHint("輸入框");
    LinearLayout.LayoutParams editTextLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, QMUIDisplayHelper.dpToPx(50));
    editTextLP.bottomMargin = QMUIDisplayHelper.dp2px(getContext(), 15);
    mEditText.setLayoutParams(editTextLP);
    layout.addView(mEditText);
    TextView textView = new TextView(mContext);
    textView.setLineSpacing(QMUIDisplayHelper.dp2px(getContext(), 4), 1.0f);
    textView.setText("觀察聚焦輸入框後,鍵盤升起降下時 dialog 的高度自適應變化。\n\n" +
            "QMUI Android 的設計目的是用於輔助快速搭建一個具備基本設計還原效果的 Android 項目," +
            "同時利用自身提供的豐富控件及兼容處理,讓開發者能專注於業務需求而無需耗費精力在基礎代碼的設計上。" +
            "不管是新項目的創建,或是已有項目的維護,均可使開發效率和項目質量得到大幅度提升。");
    textView.setTextColor(ContextCompat.getColor(getContext(), R.color.app_color_description));
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    layout.addView(textView);
    return layout;
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:26,代碼來源:QDDialogFragment.java

示例8: initView

import android.widget.ScrollView; //導入依賴的package包/類
private void initView() {
    weatherLayout = (ScrollView) findViewById(R.id.weather_layout);
    titileCity = (TextView) findViewById(R.id.title_city);
    titleUpdateTime = (TextView) findViewById(R.id.title_update_time);
    degressText = (TextView) findViewById(R.id.degress_text);
    weatherInfoText = (TextView) findViewById(R.id.weather_info_text);
    forecastLayout = (LinearLayout) findViewById(R.id.forecast_layout);
    aqiText = (TextView) findViewById(R.id.aqi_text);
    pm25Text = (TextView) findViewById(R.id.pm25_text);
    comfortText = (TextView) findViewById(R.id.comfort_text);
    carWashText = (TextView) findViewById(R.id.car_wash_text);
    sportText = (TextView) findViewById(R.id.sport_text);

    bingPicImg = (ImageView) findViewById(R.id.bing_pic_img);
    swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);

    swipeRefresh.setColorSchemeResources(R.color.colorPrimary);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    navButton = (Button) findViewById(R.id.nav_button);
}
 
開發者ID:JakeLes,項目名稱:myCoolWeather,代碼行數:22,代碼來源:WeatherActivity.java

示例9: onDirectMessageSent

import android.widget.ScrollView; //導入依賴的package包/類
@Override
public void onDirectMessageSent(final String userHandle,
                                final String msg) {
    // TODO Auto-generated method stub
    uiHandler.removeCallbacksAndMessages(null);
    uiHandler.post(new Runnable() {

        @Override
        public void run() {
            if (canChangeUI()) {
                OneSheeldTextView tweetItem = (OneSheeldTextView) activity
                        .getLayoutInflater().inflate(
                                R.layout.tweet_item,
                                lastTweetTextContainer, false);
                tweetItem.setText(activity.getString(R.string.twitter_to)+": " + userHandle + ", "+activity.getString(R.string.twitter_message)+": "
                        + msg);
                lastTweetTextContainer.addView(tweetItem);
                ((ScrollView) lastTweetTextContainer.getParent())
                        .invalidate();
            }
        }
    });
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:24,代碼來源:TwitterFragment.java

示例10: wrapScrollableView

import android.widget.ScrollView; //導入依賴的package包/類
/**
 * Wraps the given <var>scrollableView</var> into scrollable wrapper implementation that best
 * suits to the type of the given view.
 *
 * @param scrollableView The scrollable view to be wrapped into scrollable wrapper.
 * @return New scrollable wrapper instance. See description of this class for supported wrappers.
 */
@SuppressWarnings("unchecked")
public static <V extends View> ScrollableWrapper<V> wrapScrollableView(@NonNull V scrollableView) {
	if (scrollableView instanceof AbsListView) {
		return new AbsListViewWrapper((AbsListView) scrollableView);
	} else if (scrollableView instanceof RecyclerView) {
		return new RecyclerViewWrapper((RecyclerView) scrollableView);
	} else if (scrollableView instanceof ScrollView) {
		return new ScrollViewWrapper((ScrollView) scrollableView);
	} else if (scrollableView instanceof HorizontalScrollView) {
		return new HorizontalScrollViewWrapper((HorizontalScrollView) scrollableView);
	} else if (scrollableView instanceof ViewPager) {
		return new ViewPagerWrapper((ViewPager) scrollableView);
	} else if (scrollableView instanceof WebView) {
		return new WebViewWrapper((WebView) scrollableView);
	}
	return new ViewWrapper(scrollableView);
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:25,代碼來源:ScrollableWrapper.java

示例11: canChildScrollDown

import android.widget.ScrollView; //導入依賴的package包/類
public static boolean canChildScrollDown(View view) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getLastVisiblePosition() < absListView.getChildCount() - 1
                    || absListView.getChildAt(absListView.getChildCount() - 1).getBottom() > absListView.getPaddingBottom());
        } else if (view instanceof ScrollView) {
            ScrollView scrollView = (ScrollView) view;
            if (scrollView.getChildCount() == 0) {
                return false;
            } else {
                return scrollView.getScrollY() < scrollView.getChildAt(0).getHeight() - scrollView.getHeight();
            }
        } else {
            return false;
        }
    } else {
        return view.canScrollVertically(1);
    }
}
 
開發者ID:yinyiliang,項目名稱:RabbitCloud,代碼行數:22,代碼來源:PtrDefaultHandler2.java

示例12: testScrollEvents

import android.widget.ScrollView; //導入依賴的package包/類
public void testScrollEvents() {
  ScrollView scrollView = getViewAtPath(0);

  dragUp();

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

  ArrayList<Double> yOffsets = mScrollListenerModule.getYOffsets();
  assertFalse("Expected to receive at least one scroll event", yOffsets.isEmpty());
  assertTrue("Expected offset to be greater than 0", yOffsets.get(yOffsets.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.getScrollY()),
      yOffsets.get(yOffsets.size() - 1).doubleValue(),
      1e-5);
  assertTrue("Begin and End Drag should be called", mScrollListenerModule.dragEventsMatch());
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:23,代碼來源:ReactScrollViewTestCase.java

示例13: onCreate

import android.widget.ScrollView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.view_topic_activity);
    Intent intent = getIntent();
    String forum_link = intent.getStringExtra("link_to_get");
    cr= new CrawlerRunnable();
    cr.initiate_url(forum_link);
    cr.start();
    t = (TextView)findViewById(R.id.text_view2);
    t.setOnClickListener(listener);
    t.setVisibility(View.INVISIBLE);
    sv = (ScrollView)findViewById(R.id.scroll_view3);
    ll = (LinearLayout)findViewById(R.id.linear_layout3);
    try {
        handler.removeCallbacks(time_task);
        handler.postDelayed(time_task, 1000);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:m47h4r,項目名稱:arch-users-forum,代碼行數:24,代碼來源:ViewTopicActivity.java

示例14: getBitmapByView

import android.widget.ScrollView; //導入依賴的package包/類
public static Bitmap getBitmapByView(ScrollView scrollView) {
    int h = 0;
    for (int i = 0; i < scrollView.getChildCount(); i++) {
        h += scrollView.getChildAt(i).getHeight();
    }
    Bitmap bitmap = Bitmap.createBitmap(scrollView.getWidth(), h, Config.ARGB_8888);
    scrollView.draw(new Canvas(bitmap));
    return bitmap;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:BitmapUtil.java

示例15: findFirstScrollerByRootView

import android.widget.ScrollView; //導入依賴的package包/類
public static View findFirstScrollerByRootView(View  rootView){

        View firstScrollView = null;

        if(null != rootView){
            allViews = ViewUtil.getAllChildViews(rootView);
            for (View view:allViews
                 ) {
                if(view instanceof ScrollView){
                    firstScrollView = view;
                    break;
                }
            }
        }
        return firstScrollView;
    }
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:17,代碼來源:ScreenShot.java


注:本文中的android.widget.ScrollView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。