如何在Android中创建水平滚动按钮 [英] How to create horizontal scrollable buttons in android

查看:51
本文介绍了如何在Android中创建水平滚动按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要创建水平可滚动按钮的应用程序.实际上,我想做的是,我有一些日期数组,我希望每个日期都应采用按钮形式,如果用户单击该按钮,按钮,它应该打开一个与该日期相关的数据的列表视图.我不知道如何实现此功能,因此,请提前感谢您的帮助.

i am developing an application where i need to create horizontal scrollable buttons.Actually what i am trying to do is,i have an array of some dates and i want that every dates should be in form of buttons and if user clicks that button it should open a list view of the data relevant to that date.i don''t have any idea how to achieve this functionality,so any help will be cordially appreciated,thanks in advance.

推荐答案

直接编写代码!
在布局中使用下面提供的XML,它将开始水平滚动.

注意:使用内置框架不能同时具有水平和垂直滚动.


Straight to code !
Use the XML given below in your layout and it will start scrolling horizontally.

Note: You cannot have both horizontal and vertical scrolls using the built-in framework.


<scrollview xmlns:android="http://schemas.android.com/apk/res/android">
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:scrollbars="vertical">

    <horizontalscrollview xmlns:android="http://schemas.android.com/apk/res/android">
        android:layout_width="320px" android:layout_height="fill_parent">


        <tablelayout xmlns:android="http://schemas.android.com/apk/res/android">
            android:id="@+id/linlay" android:layout_width="320px"
            android:layout_height="fill_parent" android:stretchColumns="1"
            android:background="#000000"/>

    </tablelayout></horizontalscrollview>

</scrollview>


这篇关于如何在Android中创建水平滚动按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆