- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试滚动到 ScrollView 中的给定布局。我的 XML 基本上由实现各种 RelativeLayout 的 ScrollView 组成,我想以编程方式滚动到给定的一个。
我的 Activity 的 onCreate 方法中有以下代码:
// Defining my view
sv = (ScrollView)findViewById(R.id.reward_scroll_view);
// Get Layout's id from intent
Bundle extras = getIntent().getExtras();
if (extras != null) {
idToScroll = extras.getInt("uiToScroll");
sv.post(new Runnable() {
public void run() {
// Scroll to the passed element
RelativeLayout layout = (RelativeLayout) findViewById(idToScroll);
sv.smoothScrollTo(0, layout.getTop());
}
});
}
给定 anchor 的“自动滚动”正在运行,但没有“平滑”效果,只是布局的原始滚动。我错过了什么?
最佳答案
关于Android smoothScrollTo 不流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27482351/
我有 HorizontalScrollView,里面有子 Layout。将 View 添加到子布局后,我无法将 HorizontalScrollView 滚动到滚动条的右侧。 scrollTo
我正在尝试滚动到 ScrollView 中的给定布局。我的 XML 基本上由实现各种 RelativeLayout 的 ScrollView 组成,我想以编程方式滚动到给定的一个。 我的 Activi
我正在使用 smoothScrollBy() 滚动到 ListView 中的特定位置。我希望在 ListView 完成滚动时收到通知,以便将其与当前的 onScrollStateChanged() 事
我想要实现的是在单击 tab1(等等)时滚动到 scroll_position_1,如 this .我根本不明白发生了什么。下面是我的布局结构。
我已经将 HorizontalScrollView 子类化,这样我就可以拥有一些自定义的滚动行为,但我发现 smoothScrollTo 并不总是触发。我不得不使用以下代码解决此问题: smoot
我有以下情况: 我正在使用 Navigation Drawer 让用户可以轻松地在不同主题之间导航。 你可以在这里找到一张图片: https://drive.google.com/file/d/0B2
当我按下按钮时,Kotlin 中的垂直 RecyclerView(看起来像一个简单的列表)会整齐地滚动到下一个元素。 👍🏻然而,当下一个元素不在屏幕上时(例如,因为同时用户用手势滚动到不同的位置)
下一段代码: hScroll.setOnTouchListener(new View.OnTouchListener() { @Override public bool
我在 ScrollView (SV) 中有父级 RelativeLayout (RL)。在 parent RL 中,我有一个 child 也是 RL。我想将另一个子 RL 添加到父 RL 并向下滚动屏
这是我的布局:
我正在开发一个 Circular ViewPager,我已经实现了这个解决方案(https://stackoverflow.com/a/12965787/1083564)。 唯一缺少的是我在使用 se
我是一名优秀的程序员,十分优秀!