I want to show my java code in a fragment with a code view now my problem is that my code perform only for scrolling down but i want to scroll may code horizontally and vertically at the same time so now what can i do?
i already tried by nesting horizontalscrollview and scrollview but it dose not working and my app gone crush.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="saiful" />
<thereisnospon.codeview.CodeView
android:id="@+id/codeViewId"
android:layout_width="match_parent"
android:layout_height="match_parent">
</thereisnospon.codeview.CodeView>
</LinearLayout>
</ScrollView>
and my java file is
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_java, container, false);
codeView = view.findViewById(R.id.codeViewId);
codeView.setTheme(CodeViewTheme.ANDROIDSTUDIO).fillColor();
codeView.showCode(Content.java);
return view;
}
Do not mess with Horizontal and vertical scrollviews. Here is good library for that. Give it a try.
"A bidirectional panning container for Android with native scrolling for APIs 7 and up."
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.