java-没有片段显示的选项卡

java-没有片段显示的选项卡,第1张

概述我需要在应用程序顶部创建可滚动的选项卡.Tabhost看起来还可以,但是我不需要片段显示(如图所示),我只需要带有clicklistener的标签即可.我只需要像按钮这样的选项卡,它们就需要能够水平滚动和按下.关于如何或是否可以做到的任何想法?解决方法:UseHorizontalScrollViewtoachi

我需要在应用程序顶部创建可滚动的选项卡. Tabhost看起来还可以,但是我不需要片段显示(如图所示),我只需要带有clickListener的标签即可.

我只需要像按钮这样的选项卡,它们就需要能够水平滚动和按下.关于如何或是否可以做到的任何想法?

解决方法:

Use horizontalscrollview to achive this

下面我提供代码段,根据您的要求进行更改.

<?xml version="1.0" enCoding="utf-8"?><horizontalscrollview xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="wrap_content">    <linearLayout        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent">        <linearLayout            androID:layout_wIDth="fill_parent"            androID:layout_height="fill_parent"            androID:orIEntation="vertical">            <Imagebutton                androID:ID="@+ID/imagebutton1"                androID:layout_wIDth="wrap_content"                androID:layout_height="100dp"                androID:src="@drawable/pic7"                androID:text="image1" />            <TextVIEw                androID:ID="@+ID/text"                androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content"                androID:gravity="center"                androID:text="TextvIEw1" />        </linearLayout>        <linearLayout            androID:layout_wIDth="fill_parent"            androID:orIEntation="vertical"            androID:layout_height="fill_parent">            <Imagebutton                androID:text="image2"                androID:ID="@+ID/imagebutton2"                androID:layout_wIDth="wrap_content"                androID:layout_height="100dp"                androID:src="@drawable/pic2" />            <TextVIEw                androID:ID="@+ID/text"                androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content"                androID:gravity="center"                androID:text="TextvIEw2" />        </linearLayout>        <linearLayout            androID:layout_wIDth="fill_parent"            androID:orIEntation="vertical"            androID:layout_height="fill_parent">            <Imagebutton                androID:text="image3"                androID:ID="@+ID/imagebutton3"                androID:layout_wIDth="wrap_content"                androID:layout_height="100dp"                androID:src="@drawable/pic7" />            <TextVIEw                androID:ID="@+ID/text"                androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content"                androID:gravity="center"                androID:text="TextvIEw3" />        </linearLayout>        <linearLayout            androID:layout_wIDth="fill_parent"            androID:orIEntation="vertical"            androID:layout_height="fill_parent">            <Imagebutton                androID:text="image4"                androID:ID="@+ID/imagebutton4"                androID:layout_wIDth="wrap_content"                androID:layout_height="100dp"                androID:src="@drawable/pic5" />            <TextVIEw                androID:ID="@+ID/text4"                androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content"                androID:gravity="center"                androID:text="TextvIEw4" />        </linearLayout>    </linearLayout></horizontalscrollview>

总结

以上是内存溢出为你收集整理的java-没有片段显示的选项卡全部内容,希望文章能够帮你解决java-没有片段显示的选项卡所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1120912.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存