简体   繁体   English

水平和垂直滚动。 如何在代码视图中显示Java代码并水平和垂直滚动代码?

[英]Scrolling Both horizontally and vertically . how can i show my java code in a code view and scroll my code both horizontally and vertically?

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? 我想用代码视图在片段中显示我的Java代码,现在的问题是我的代码仅用于向下滚动,但是我想同时滚动才能水平和垂直编写代码,所以现在我该怎么办?

i already tried by nesting horizontalscrollview and scrollview but it dose not working and my app gone crush. 我已经通过嵌套horizo​​ntalscrollview和scrollview尝试过,但是它不起作用,我的应用程序崩溃了。

<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 我的java文件是

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." “适用于Android的双向平移容器,具有API 7及更高版本的本地滚动。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 此代码用于水平显示pdf文本,如何在pdf页面上将其垂直更改 - This code for Horizontally displaying the text in pdf, how do I change it into vertically on my pdf pages 如何让我的循环水平显示而不是垂直显示? - How can I get my loops to display horizontally instead of vertically? 如何让我的二维数组在 java 中水平和垂直显示? - How do I make my two-dimensional array show horizontally as well as vertically in java? 如何在 android 工作室中垂直和水平填充图像数组 - How can I fill array of Images both vertically and horizontally in android studio 在网格布局中垂直和水平缩放图像 - Scale image both vertically and horizontally within a gridlayout 实现一个可以垂直和水平滚动的列表 - Implementing a list that is both vertically & horizontally scrollable 使Java JScrollpane垂直滚动而不是水平滚动 - Make Java JScrollpane scroll vertically instead of horizontally 一次水平和垂直调整窗口(主机)的大小 - Resize window (main frame) both horizontally and vertically in one time 在Java中水平,垂直和对角(两个方向)搜索2D数组 - Searching through 2D array horizontally, vertically, and diagonally (both directions) in Java 如何使Swing JComboBox沿水平方向而不是垂直方向扩展? - How do I make my Swing JComboBox expand horizontally instead of vertically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM