Kha*_*dal 1 layout android android-layout
我在scrollview中有一个linearlayout
<ScrollView
android:id="@+id/scrollID"
android:layout_width="match_parent"
android:layout_height="80dip"
android:visibility="gone"
android:background="@android:color/darker_gray"
android:hapticFeedbackEnabled="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/black"
android:id="@+id/showInfoLayout">
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
并在代码中我更改scrollView宽度和高度比应用程序崩溃我的更改代码是
@Override
public boolean onDoubleTap(MotionEvent e) {
routeScrollView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
return true;
}
Run Code Online (Sandbox Code Playgroud)
双击事件工作正常,logcat如下

1)您的LinearLayout的layout_height应该包装内容
2)用(TypeOfScrollViewParent)替换ViewGroup.LayoutParams .LayoutParams
| 归档时间: |
|
| 查看次数: |
781 次 |
| 最近记录: |