Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以编程方式在Android用户界面中滚动查看水平视图_Android_Android Layout_User Interface - Fatal编程技术网

以编程方式在Android用户界面中滚动查看水平视图

以编程方式在Android用户界面中滚动查看水平视图,android,android-layout,user-interface,Android,Android Layout,User Interface,我正在用android编程显示,我需要水平和垂直滚动视图。已垂直工作,但仍不能水平工作 代码如下: ScrollView sv = new ScrollView(this); LinearLayout linearLayout = new LinearLayout(this); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(FILL_PARENT, WRAP_CONTENT); linearL

我正在用android编程显示,我需要水平和垂直滚动视图。已垂直工作,但仍不能水平工作

代码如下:

    ScrollView sv = new ScrollView(this);
    LinearLayout linearLayout = new LinearLayout(this);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(FILL_PARENT, WRAP_CONTENT);
    linearLayout.setLayoutParams(params);
    linearLayout.setOrientation(VERTICAL); 

    linearLayout.addView(tableLayout(count));
    linearLayout.addView(submitButton());
    sv.addView(linearLayout);
    setContentView(sv);
请帮我使它水平工作


谢谢:)

如果需要水平滚动,请尝试。但是,您不能同时执行水平和垂直操作,在这种情况下,您可能需要编写一个自定义视图。

如果需要水平滚动,请尝试。但是,您不能同时执行水平和垂直操作,在这种情况下,您可能需要编写一个自定义视图。

您能否解释有关costum视图的更多细节?您能否解释有关costum视图的更多细节?请看这个问题:看这个问题:
HorizontalScrollView sv = new HorizontalScrollView(this);
LinearLayout linearLayout = new LinearLayout(this);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
linearLayout.setLayoutParams(params);
linearLayout.setOrientation(LinearLayout.HORIZONTAL);