一个顶部有按钮的list列表布局xml文件

本ui来之一个网上的程序。谢谢原作者的分享。


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="250px"
    android:layout_height="400px"
    android:background="@drawable/white"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/mPath"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5px"
        android:textColor="@drawable/blue"
        android:textSize="18sp" >
    </TextView>


    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="330px" >
    </ListView>


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/white"
        android:gravity="center"
        android:orientation="horizontal" >


        <Button
            android:id="@+id/buttonConfirm"
            android:layout_width="125px"
            android:layout_height="fill_parent"
            android:text="确定" />


        <Button
            android:id="@+id/buttonCancle"
            android:layout_width="125px"
            android:layout_height="fill_parent"
            android:text="取消" />
    </LinearLayout>


</LinearLayout>


调用的java中:

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fileselect);
requestWindowFeature(Window.FEATURE_NO_TITLE);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是Flutter实现一个顶部滚动横向列表布局代码: ```dart import 'package:flutter/material.dart'; class HorizontalList extends StatefulWidget { @override _HorizontalListState createState() => _HorizontalListState(); } class _HorizontalListState extends State<HorizontalList> { final List<String> items = [ 'Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 8', 'Item 9' ]; int selectedIndex = 0; @override Widget build(BuildContext context) { return Container( height: 80, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: items.length, itemBuilder: (BuildContext context, int index) { return GestureDetector( onTap: () { setState(() { selectedIndex = index; }); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Text( items[index], style: TextStyle( color: index == selectedIndex ? Colors.blue : Colors.grey, fontWeight: index == selectedIndex ? FontWeight.bold : FontWeight.normal, ), ), SizedBox(height: 5), Container( height: 2, width: 30, color: index == selectedIndex ? Colors.blue : Colors.transparent, ), ], ), ), ); }, ), ); } } ``` 在这个示例中,我们创建了一个`HorizontalList`小部件,它包含一个名称为`items`的字符串列表,其中包含我们要显示的项目。 我们使用`ListView.builder`小部件创建一个横向滚动列表,其中每个项目都由`GestureDetector`小部件包装,以便我们可以检测用户的点击事件。在触发点击事件时,我们使用`setState`方法更新`selectedIndex`变量的值,并根据该值更改所选项目的文本和下划线的颜色。 最终,我们将所有这些内容包装在一个`Container`小部件中,并将其高度设置为80,使其在页面上占据适当的空间。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值