标签: android-scrollview

动态字幕的文本

是否可以将列表视图的java编码中的文本添加到Android中的选框滚动.如果是的话,请告诉我怎么做?

如果需要,我将发布使用的代码.这是用于listview的XML,如下所示

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
     <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </LinearLayout>
    <ListView
        android:id="@+id/audiolist_listView"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:background="@drawable/backgroundimg"
        android:divider="@drawable/gradient"
        android:dividerHeight="1dp"
        android:scrollbars="vertical" >
    </ListView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

listview的java类如下

public class Audiovediolist extends Activity implements OnItemClickListener {
    private ListView audioList;
    private Intent frmHome;
    private ArrayList<HashMap<String, String>> dataList;
    private HashMap<String, String> map;
    private HashMap<String, String> data;
    private int Screen_Id;
    private AdView adView;
    String name;
    String mSign[] = { "Aries-Mesam", "Taurus-Vrushabham", "Gemini-Midhunam",
            "Cancer-Karkatakam", "Leo-Simham", "Virgo-Kanya", "Libra-Tula",
            "Scorpio-Vruchikam", "Sagittarius-Dhanussu", "Capricorn-Makaram", …
Run Code Online (Sandbox Code Playgroud)

android textview android-listview android-xml android-scrollview

5
推荐指数
1
解决办法
2134
查看次数

ScrollView上的YouTubePlayerView

首先,我想指出Android中似乎有一个限制,其中有一个SurfaceViewon ScrollView不能像你期望的那样工作.这在这里解释 (内部VideoView使用,SurfaceView所以它有这个问题).但似乎是一个解决方法VideoView它为我工作.

现在,我还想使用新的Android API for Android在我们的Android应用中显示嵌入的YouTube视频.的YouTubePlayerView作为层次结构中的观看者示出低于其也实现了嵌入式视频播放器呈现以上,因为它使用一个SurfaceView提到的问题.

YouTubePlayerView上的SurfaceView

我无法找到解决此问题的方法.有一个YouTubePlayerViewScrollView是一个相当普遍的情况下使用我们的应用程序(也可能是其他许多人太).我将不胜感激任何评论.

android youtube-api android-scrollview android-youtube-api

5
推荐指数
1
解决办法
797
查看次数

如何在Android中的Opengl ES2.0中将ScrollView添加到GLSurfaceview

我正在Android中的OpenGLES2.0中开发一个Auto-cad应用程序.
我想添加平移功能.

这就是我实现此平移功能的方法:
[平移功能 - 只需使用触摸事件将GLSurfaceview拖动到顶部,底部,左侧和右侧].

我需要在android中的GLSurfaceview中添加一个Scrollable View.
当我尝试在GLSurfaceView中添加滚动视图时,它将无法正常工作.
然后,我也尝试将GLSurfaceview添加到ScrollView中.
此方法也不起作用.

请给我一些示例代码.

android scrollviewer scrollview opengl-es-2.0 android-scrollview

5
推荐指数
0
解决办法
842
查看次数

SlidingUpPanelLayout和ScrollView

我有一个SlidingUpPanelLayout,它将图像保存为顶视图,还有一个需要滑动的视图寻呼机.它viewpager有3个片段,其中两个是列表视图.所以我希望能够在拉起时扩展视图寻呼机,一旦视图寻呼机启动,我希望能够scrollviews在片段内部滚动.但是当拉下来scrollview以防万一没有滚动时,我想开始崩溃viewpager.因此SlidingUpPanelLayout,如果没有更多要滚动的内容,请建议如何在拉动滚动视图时进行折叠?

在这里,我发布了一些代码:我尝试捕获触摸事件并onInterceptTouchEvent以下列方式覆盖SlidingUpPanel 函数:

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    if (isHandled) {
        Log.i("interceptToch", "HEREEE");
        return onTouchEvent(ev);
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)

所以当SlidingUpPanelLayout扩展时,我设置了isHandled = false.因此,当slidingUpPanelLayout展开时,所有触摸事件都将传递给其子视图.

而且我也放入onTouchEventscrollView,以便解锁SlidingUpPanelLayout.onInterceptTouchEvent:

public boolean onTouch(View v, MotionEvent event) {
    int action = event.getAction();
    if (action == MotionEvent.ACTION_DOWN) {
        scroll = 0;
        y = event.getY();
    } else if (action == MotionEvent.ACTION_MOVE) {
        if (scroll_view_summary.getScrollY() == 0 && …
Run Code Online (Sandbox Code Playgroud)

android slideup android-sliding android-scrollview android-event

5
推荐指数
2
解决办法
1万
查看次数

Horizo​​ntalScrollView不完全向右滚动

我目前的实施

我有一个HorizontalScrollView用XML创建的包含几个LinearLayout孩子的东西.我在下面添加了此代码.

有两个LinearLayout容器用的ID group_one,并group_two和它们在运行时编程方式填充.

我还HorizontalScrollView根据View要插入的对象数量来修复运行时的宽度.

这个解决方案非常适合孩子们在HorizontalScrollView不需要滚动的情况下适应的情况.

问题

一旦我需要滚动(有更多的孩子可以在固定宽度内显示HorizontalScrollView),滚动条将不会一直向右,即使我可以看到子布局的宽度正确,并且我可以看到滚动条不会再进一步​​了.

我的问题

为什么滚动条会进一步向右移动?

我的守则

Horizo​​ntalScrollView XML

<!-- THIS IS WHERE THE PLUGIN BUTTONS ARE HOUSED -->
    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="horizontal"
        android:id="@+id/map_plugin_scroll_view"
        android:background="@color/map_plugin_background">

    <!-- Enclosing box to layout the two groups.-->
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_margin="8dp"
        android:id="@+id/group_container">

        <!-- These layouts contain the map plugins. -->
        <LinearLayout
            android:id="@+id/group_one"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="4dp"/>

        <LinearLayout
            android:id="@+id/group_two"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"/> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-scrollview

5
推荐指数
1
解决办法
3361
查看次数

动画视图移动到我的布局之外

我有一个ScrollView包含几个RelativeLayouts,LinearLayouts像这样:

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >

      <RelativeLayout >

      </RelativeLayout>

      <LinearLayout >

      </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

现在,当我点击其中一个布局时,我希望它能够扩展并显示更多信息.我已经成功地通过以下方式缩放我想要的布局PropertyAnimator:

relativeLayout.animate().scaleY(100).setDuration(duration).start();
Run Code Online (Sandbox Code Playgroud)

同时,我使用另一个PropertyAnimator移动Views到我垂直扩展的那个下方,以便有足够的空间用于扩展布局.到目前为止它正在运作.

不幸的是,Views那个移动不知何故最终ScrollView落在了视口之外,所以我无法向下滚动并查看其中的信息Views.从本质上讲,这些视图的垂直平移使其下部无法访问,因为视口也不会扩展.

我已经开始android:fillViewPort="true"ScrollView.而且我也试图以编程方式进行,setFillViewPort()但都没有任何影响.

怎么了?为什么不起作用?

java android android-animation android-scrollview

5
推荐指数
1
解决办法
3007
查看次数

SwipeRefreshLayout干扰ViewPager中的ScrollView

我在ViewPager周围有一个SwipeRefreshLayout.ViewPager加载的片段包含ScrollViews.当我向下滚动它工作正常,但当我向上滚动时,SwipeRefreshLayout激活而不让ScrollView首先向上滚动.如何确保ScrollView具有优先权?

当SwipeRefreshLayout位于ScrollView外部的各个片段中时,它工作正常,但我需要它在ViewPager周围的活动本身.

以下是相关布局:

活动:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#EEEEEE"
    android:fitsSystemWindows="true">

    <include layout="@layout/toolbar" />

    <io.karim.MaterialTabs
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:background="@color/primary"
        app:mtIndicatorColor="@color/icons"
        app:mtIndicatorHeight="2dp"
        app:mtSameWeightTabs="true"
        app:mtPaddingMiddle="false"
        app:mtTextColorSelected="@color/icons"
        android:textColor="@color/icons"
        android:elevation="4dp"
        tools:ignore="UnusedAttribute" />

    <android.support.v4.widget.SwipeRefreshLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/swipeRefresh"
        android:layout_height="wrap_content"
        android:layout_width="match_parent">

        <android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="0dp" />

    </android.support.v4.widget.SwipeRefreshLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

ViewPager加载的片段(有5个标签,每个标签都有一个):

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="me.sargunvohra.android.purduediningcourts.presenter.MenuFragment">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingStart="@dimen/activity_horizontal_margin"
            android:paddingEnd="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            >

            <!-- Content snipped for brevity -->

            <!-- blah blah... lots of content here -->

        </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

如果您需要更多信息,请点击 GitHub上的回购:https …

android android-layout android-fragments android-scrollview android-viewpager

5
推荐指数
2
解决办法
6753
查看次数

ScrollView没有投掷.慢慢滚动

我有以下布局:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?android:attr/actionBarSize"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/datatransfer_measure_list_layout_no_data"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/datatransfer_measure_list_textview_no_data"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dp"
                android:layout_marginEnd="40dp"
                android:layout_marginStart="40dp"
                android:layout_marginTop="20dp"
                android:gravity="center"
                android:padding="5dp"
                android:text="@string/measure_data_empty"
                android:textColor="@color/textcolorprimary"
                android:textSize="18sp" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_gravity="center"
                android:layout_marginBottom="20dp"
                android:layout_marginEnd="20dp"
                android:layout_marginStart="20dp"
                android:background="@android:color/darker_gray"
                android:importantForAccessibility="no" />
        </LinearLayout>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/datatransfer_measure_list_row_parent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="15dp"
            android:clipToPadding="false"
            android:importantForAccessibility="no"
            android:paddingBottom="5dp"
            android:textColor="@color/textcolorprimary" />

        <Button
            android:id="@+id/datatransfer_measure_list_button_send"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="10dp"
            android:layout_marginEnd="40dp"
            android:layout_marginStart="40dp"
            android:background="@drawable/custom_button_ok"
            android:gravity="center"
            android:padding="10dp"
            android:text="@string/common_save"
            android:textColor="@drawable/custom_button_positive_text_color"
            android:textSize="20sp" />

        <Button
            android:id="@+id/datatransfer_measure_list_button_reset"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="20dp"
            android:layout_marginEnd="40dp"
            android:layout_marginStart="40dp"
            android:background="@drawable/custom_button_cancel"
            android:gravity="center"
            android:padding="10dp" …
Run Code Online (Sandbox Code Playgroud)

android android-scrollview

5
推荐指数
1
解决办法
2430
查看次数

RecyclerView高度wrap_content计算不正确

我想要我RecyclerViewwrap_content.我不希望在RecyclerView中滚动任何内容,它应该调整到内部孩子的高度.我不想让我的父ScrollView滚动我的活动内容.

<FrameLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <!-- scrolls a little bit as RecyclerView goes slightly down beyond the screen -->
  <ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">
      <!-- still scrolls inside -->
      <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)

填充RecyclerView:

myAdapter = new MyAdapter();
layoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(myAdapter);
Run Code Online (Sandbox Code Playgroud)

我使用RecyclerView库来wrap_content解决问题:

dependencies {
    compile 'com.android.support:recyclerview-v7:25.0.0'
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

基本上,RecyclerView高度计算对我来说效果不佳.RecyclerView仍然有它自己的滚动和ScrollView滚动一点.如果我尝试将一些rediculous RecyclerView高度设置为1000dp,使其大于项目总高度,则滚动按需工作,例如RecyclerView不滚动,ScrollView使用所有RecyclerView项目滚动活动.

那我做错了什么?:)

android android-scrollview android-recyclerview android-wrap-content

5
推荐指数
1
解决办法
1127
查看次数

恢复活动时,Scrollview会变黑

当我使用ScrollView离开活动然后返回它时,ScrollView变黑.在发布时,颜色是正确的.只是当我离开并返回时它变黑了.我已经尝试设置ScrollView和内部LinearLayouts的背景,但它没有任何区别.ScrollView会被ViewPager中的片段夸大,以防万一.

任何想法为什么会出现这种情况?

这是XML

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll_formatted"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="false"
    android:focusable="false"
    android:focusableInTouchMode="false">

    <LinearLayout style="@style/LinearLayoutVertical">

        <ImageView
            android:id="@+id/image_formatted"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/image_review_cd"
            android:scaleType="centerCrop"/>

        <LinearLayout
            style="@style/LinearLayoutVertical.WrappedVertical"
            android:id="@+id/subject_rating_formatted">

            <TextView
            android:id="@+id/subject_formatted"
            style="@style/TextView.Subject.Bold"
            android:background="?darkBackground"/>

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="?darkBackground">

            <RatingBar
                android:id="@+id/rating_formatted"
                style="@style/RatingBarFiveStar.Indicator.PointOneStep"
                android:background="?darkBackground"/>
            </FrameLayout>

            <TextView
                android:id="@+id/stamp_formatted"
                style="@style/FormattedText.Stamp"
                android:background="?darkBackground"/>
        </LinearLayout>

        <TextView
            android:id="@+id/headline_formatted"
            style="@style/TextView.Headline"/>

        <TextView
            android:id="@+id/tags_formatted"
            style="@style/FormattedTitleValue"/>

        <include
            android:id="@+id/comment_formatted"
            layout="@layout/formatted_title_value"/>

        <include
            android:id="@+id/locations_formatted"
            layout="@layout/formatted_title_value"/>

        <include
            android:id="@+id/criteria_formatted"
            layout="@layout/formatted_title_value"/>

        <include
            android:id="@+id/facts_formatted"
            layout="@layout/formatted_title_value"/>

        <include
            android:id="@+id/images_formatted"
            layout="@layout/formatted_title_data"/>

    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

编辑:这是活动和片段:

活动

public class ActivityFormatReview extends FragmentActivity implements LaunchableUi,
        OptionSelectListener, FormattedPagerAdapter.FragmentsObserver {
    private static final String TAG …
Run Code Online (Sandbox Code Playgroud)

android android-scrollview

5
推荐指数
1
解决办法
314
查看次数