标签: scrollview

在ScrollView中拉伸TableLayout

我有这个TableLayout:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout" android:layout_height="fill_parent"
android:layout_alignParentBottom="true" android:scrollbars="horizontal|vertical"
android:layout_width="fill_parent" android:scrollbarStyle="outsideInset">
<HorizontalScrollView android:id="@+id/horizontalView" android:layout_height="fill_parent"
            android:layout_width="fill_parent">
    <TableLayout android:id="@+id/reportTableLayout"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:stretchColumns="1">
    </TableLayout>
</HorizontalScrollView>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

我已将所有layout_width设置为fill_parent,但我的Table列似乎没有拉伸并填充宽度空间的其余部分.左边还有一个边距,但我希望我的桌子可以伸展整个屏幕宽度.有任何想法吗?谢谢.

user-interface android scrollview tablelayout

0
推荐指数
1
解决办法
3020
查看次数

Android只发出第一个TextView,在ScrollView中显示文本

我遇到的问题是只显示第一个TextView(eventItemTitle)的文本.正如您所看到的,我现在已经更改为插入文字字符串,但仍然只能看到标题.

我究竟做错了什么?

布局:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/eventItemTitle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="16sp"
            android:textStyle="bold"
            android:textColor="#FFCC00">
        </TextView>

        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/eventItemDescription"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        </TextView>
    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

活动类:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.event_item);
    [...]
    TextView text = (TextView) findViewById(R.id.eventItemTitle);
    text.setText(event.getTitle() + "\n");

    TextView descTV = (TextView) findViewById(R.id.eventItemDescription);
    descTV.setText("i'm here");
Run Code Online (Sandbox Code Playgroud)

android scrollview

0
推荐指数
1
解决办法
581
查看次数

Android:以编程方式向ScrollView添加按钮

我有一个ScrollView包含buttons和textviews.

我希望insert a new button滚动视图中途(索引3)但得到错误," ScrollView只能托管一个直接子项 "

这不可能吗?

Button b = new Button(this);
scrView.AddView(b,3);
Run Code Online (Sandbox Code Playgroud)

????

android scrollview

0
推荐指数
1
解决办法
2981
查看次数

Android:尝试扩展ScrollView以适应屏幕上的空白区域,即使我只有一行文本

所以我想要做的就是能够点击我的TextView.我在ScrollView中有一个TextView,我试图这样做,所以当我点击屏幕时会发生一个事件.目前,当我点击我的TextView时,事件将会发生.然而,问题来自于:当我只有一行文本时,我必须单击该行文本才能检测到onTouch.我想扩展我的TextView以覆盖屏幕上的空白区域(我的屏幕底部有两个按钮).使用真实手势控制的问题在于,当我点击屏幕上的按钮时,它也会检测到,这样就无法单击.我一直试图解决这个问题,但由于某些原因它不起作用.这是我的代码.

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()){
            case R.id.close:
                finish();
                break;  
            case R.id.flashcard:
                if(tv.getText().equals(myCursor.getString(iFront)))      {
                    tv.setText(myCursor.getString(iBack));
                    break;
                }
                tv.setText(myCursor.getString(iFront));
                break;
            case R.id.add_new:
                Intent list = new Intent("com.example.flashcards.ADD_FLASHCARD");
                startActivity(list);
                break;
        }
    }


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ScrollView 
    android:id="@+id/scrollable"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight=".1"
    android:gravity="center">
    <TextView
        android:id="@+id/flashcard"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:scrollbars="vertical"
        android:textSize="20dp" />
</ScrollView>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <Button
        android:id="@+id/add_new"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.55"
        android:text="Add New" />

    <Button
        android:id="@+id/close"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.55"
        android:text="close" …
Run Code Online (Sandbox Code Playgroud)

android scrollview textview

0
推荐指数
1
解决办法
3173
查看次数

iOS滚动视图不起作用

有人请帮助我一直试图在过去的5个小时内解决这个问题,我开始疯了!

在我的滚动视图中,我在顶部有一个图像,底部有一个文本框,所以我知道它的工作当我进入iOS 6.1 iphone模拟器它没有完全滚动,它会下降一点但不是全部方式.我没有在任何人再次问起之前使用故事板,而且在编码方面我是一个完全自学的白痴,我一直在看youtube视频如何做到这一点,我已经跟着它喝茶,但它仍然无法正常工作.

viewcontroller.h #import

@interface ViewController : UIViewController {

    IBOutlet UIScrollView *scroller;

}   


@end
Run Code Online (Sandbox Code Playgroud)

viewcontroller.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320,910)];
    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
Run Code Online (Sandbox Code Playgroud)

scrollview scroller ios

0
推荐指数
1
解决办法
7629
查看次数

无法滚动并单击scrollview内gridview上的项目

好的伙计们,我有这样的布局

<ScrollView
android:id="@+id/scrollViewTree"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<include
android:id="@+id/layoutGallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/layout_gallery_obstruction" >
</include>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

这是*layout_gallery_obstruction*

?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/textViewGalleryObs"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/buttonGalleryObs"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="@string/obstruction_title_gallery" />

    <Button
        android:id="@+id/buttonGalleryObs"
        android:layout_width="100dp"
        android:layout_height="35dp"
        android:layout_marginLeft="30dp"
        android:layout_toRightOf="@+id/textViewGalleryObs"
        android:text="@string/obstruction_gallery_add"
        android:textSize="12sp" />

    <GridView
        android:id="@+id/gridViewGalleryObs"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignLeft="@+id/textViewGalleryObs"
        android:layout_below="@+id/buttonGalleryObs"
        android:columnWidth="90dp"
        android:gravity="center"
        android:horizontalSpacing="5dp"
        android:numColumns="4"
        android:stretchMode="columnWidth"
        android:verticalSpacing="5dp" >
    </GridView>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我为gridview使用自定义适配器,这是单元格的布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="@android:color/transparent"
        android:contentDescription="@string/app_name" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

好吧我的问题是,我无法滚动我的gridview,我无法点击我的gridview上的项目.有谁知道如何解决这个问题?谢谢你.:)

android gridview scrollview

0
推荐指数
1
解决办法
7084
查看次数

如何在滚动视图中添加表格视图?

我在滚动视图中添加了一个表视图,它在iOS的情况下顺利工作,但在Android的情况下,表视图不滚动.

我已经描述了下面描述我的问题的代码.建议我任何可以帮助解决我的问题的答案.

var rows = [];

var win = Ti.UI.createWindow({
    backgroundColor:'white'
});

var scrollableView = Ti.UI.createScrollView({
    top : 0,
    contentWidth : '100%',
    contentHeight : 'auto'
});

var fruit = Ti.UI.createView({
    top : 40,
    width : '70%',
    height : 20,
    left : 10,
    backgroundColor:'#000'
});
var fruitLabel = Ti.UI.createLabel({
    text : "Fruit list",
    font:{
        fontSize : 15,
        fontWeight : 'bold'
    },
    color : 'red'
});
fruit.add(fruitLabel);
var fruitTableView = Titanium.UI.createTableView({
    top : 70,
    width : 200,
    height : 150,
    left : …
Run Code Online (Sandbox Code Playgroud)

android scrollview titanium tableview

0
推荐指数
1
解决办法
2203
查看次数

ListView动态加载和检索服务器中的数据

我有listview项目超过500个产品.我需要检索数据限制50.每当我滚动时,列表必须加载到接下来的50个项目.

你的回答更受赞赏.提前致谢.

android listview scrollview

0
推荐指数
1
解决办法
588
查看次数

NestedScrollView中的MapView无法平滑滚动

我在NestedScroollView内的MapView有问题。我的Google地图显示正确,但是,当我尝试滚动地图时,它不起作用。我不知道该怎么解决。谁能帮我?谢谢!

那是我的代码:Dog_view.xml

...
<android.support.v4.widget.NestedScrollView
    android:fillViewport="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/nestedScroll"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <include layout="@layout/dog_view_layout"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>

</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)

dog_view_layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:background="#000"
    android:layout_height="wrap_content"
    android:paddingTop="20dp">
    <com.google.android.gms.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

狗片段

...
    MapView mMapView;
    private GoogleMap googleMap;


    public DogFragment(){

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.dog_view, container, false);
        this.dog = getArguments().getParcelable("data");
        mMapView = (MapView) rootView.findViewById(R.id.mapView);
        mMapView.onCreate(savedInstanceState);
        mMapView.onResume(); // needed to get the map to display immediately
        try {
            MapsInitializer.initialize(getActivity().getApplicationContext());
        } catch (Exception e) {
            e.printStackTrace(); …
Run Code Online (Sandbox Code Playgroud)

xml android google-maps scrollview

0
推荐指数
1
解决办法
690
查看次数

如何在Flutter中使用SingleChildScrollView和GridView实现连续滚动

我目前有一个SingleChildScrollView作为父级,一个GridView作为子级小部件之一。一切工作正常,但是当GridView完成滚动时,滚动不会传递给父级ScrollView。在“横向”方向上,GridView占据整个屏幕,因此用户只能滚动GridView。如何通过滚动?

SingleChildScrollView(
  controller: _hideButtonController,
  child: Container(
    padding: EdgeInsets.only(bottom: 80.0), //padding for fab
    child: Column(
      children: <Widget>[
        _previousWidgets(),
        _gridWidget(),
      ],
    ),
  ),
);
Run Code Online (Sandbox Code Playgroud)

scroll gridview scrollview flutter flutter-layout

0
推荐指数
2
解决办法
886
查看次数