Android嵌套的Scrollview无法使用Recyclerview平滑滚动?
我有三个Recyclerview,其中包含嵌套ScrollView中的内容。什么样的方法可以使它更平滑、更快?提前感谢 我已经尝试了scrollview,但结果是一样的。是否有任何替代方案或解决方案可用Android嵌套的Scrollview无法使用Recyclerview平滑滚动?,android,xml,Android,Xml,我有三个Recyclerview,其中包含嵌套ScrollView中的内容。什么样的方法可以使它更平滑、更快?提前感谢 我已经尝试了scrollview,但结果是一样的。是否有任何替代方案或解决方案可用 <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.co
<android.support.v4.widget.NestedScrollView 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:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#11180e"
tools:context="com.dodock.footylightx.android.controller.livescoredetails.lineups.LineupsFragment">
<LinearLayout
android:descendantFocusability="blocksDescendants"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--android:weightSum="2"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#385401"
android:orientation="horizontal"
android:weightSum="2">
<TextView
style="@style/HeaderTextStyle"
android:id="@+id/home_team_name_tv"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="left|center_vertical"
android:textColor="@color/White" />
<TextView
style="@style/HeaderTextStyle"
android:id="@+id/home_team_formation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:textColor="@color/White" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/line_up_local_team_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_local_field" />
<!--android:layout_weight="1"-->
<android.support.v7.widget.RecyclerView
android:id="@+id/line_up_visitor_team_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_visitor_field" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#385401"
android:orientation="horizontal"
android:weightSum="2">
<TextView
style="@style/HeaderTextStyle"
android:id="@+id/away_team_name_tv"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="left|center_vertical"
android:textColor="@color/White" />
<TextView
style="@style/HeaderTextStyle"
android:id="@+id/away_team_formation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:textColor="@color/White" />
</LinearLayout>
<!--android:layout_weight="1"-->
<TextView
style="@style/HeaderTextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/lineup_textview_bg"
android:text="Bench"
android:textAlignment="center"
android:textColor="@color/White" />
<android.support.v7.widget.RecyclerView
android:id="@+id/substitution_home_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#385401" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
将“,”替换为“+”。这就是在Java中连接的方式。否则,您将告诉它获取一个额外的参数
,并使makeText()
函数无效
Toast.makeText(MainActivity.this, "Selected Os Position:" + position +
"Select Os :"+osList[position], Toast.LENGTH_SHORT).show();
以后,请解释您遇到的问题,包括任何错误/异常消息。尝试以下操作:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(MainActivity.this, "Selected Os Position:"+position,
"Select Os :"+parent.getAdapter().getItem(position), Toast.LENGTH_SHORT).show();
}
代码中有语法错误。正如您在使用的答案中所提到的,不是+表示串联。下面的代码将起作用
Toast.makeText(MainActivity.this, "Selected Os Position:"+position+"Select Os :"+osList[position], Toast.LENGTH_SHORT).show();
我想一个简单的“Toast.makeText(MainActivity.this,“Selected Os Position:”+Position+“Select Os:”+osList[Position],Toast.LENGTH_SHORT).show();”就行了……是的,因为没有任何带有四个参数的
makeText()
方法。不要说“试试这个”,你应该解释你做了哪些不同的事情,以及为什么OP应该尝试这样做。
Toast.makeText(MainActivity.this, "Selected Os Position:"+position+"Select Os :"+osList[position], Toast.LENGTH_SHORT).show();