标签: tabview

内部对话框内的选项卡布局内的Android listview无法显示滚动条

我有一个扩展Dialog的自定义对话框类.在这里面我有一个带有2个标签的标签布局.在每个选项卡中,我有一个列表视图.一切正常但我不能让滚动条显示出来.

这是我的XML:

<?xml version="1.0" encoding="utf-8"?>

<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TabHost01"
android:layout_width="300dp"
android:layout_height="300dp">

    <LinearLayout
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    <ListView
        android:id="@+id/ListView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:scrollbarAlwaysDrawVerticalTrack="true"/>

    <ListView
        android:id="@+id/ListView02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:scrollbarAlwaysDrawVerticalTrack="true"/>

    </FrameLayout>
</LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)

这是我设置的代码的一部分:

    // get this window's layout parameters so we can change the position
WindowManager.LayoutParams params = getWindow().getAttributes(); 

    // change the position. 0,0 is center
    params.x = 0;
    params.y = 250;
    this.getWindow().setAttributes(params); 

    // no title on this dialog
requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView(R.layout.myLayout);

// instantiate our list …
Run Code Online (Sandbox Code Playgroud)

android listview dialog tabview

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

以编程方式获取TabBar中ViewController的索引

如何以编程方式从视图控制器文件中的视图控制器的选项卡栏(从最左边的选项卡开始为0)获取索引.

我用这个切换视图:

[self.tabBarController setSelectedIndex:nextIndex];
Run Code Online (Sandbox Code Playgroud)

我希望能够设置:

int nextIndex = currentIndex++;
Run Code Online (Sandbox Code Playgroud)

我如何获得当前指数?

编辑:以下三个答案都是正确的,谢谢你们.公平地说,我将选择首先发布的那个.

ios tabview

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

使用JSF 2.0从Backing bean更改Tab

我想从支持bean更改选项卡,我该怎么做?

<h:form id=form>  

    <p:growl id="growl" showDetail="true" />  

    <p:tabView id="tabView" dynamic="true" widgetVar="detailsTab">  

        <p:ajax event="tabChange" listener="#{bean.onTabChange}" update=":form:growl"/>  

        <p:tab title="Tab1" id="emp">  
            <h:panelGrid columns="2" cellpadding="10">  


              </h:panelGrid>  
        </p:tab>  

        <p:tab title="Tab 2 " id="schedule1">  
            <h:panelGrid columns="2" cellpadding="10">  


            </h:panelGrid>  



        </p:tab>  

        <p:tab title="Tab 3" id="schedule2">  
        <p:schedule value="#{bean.eventModel}" slotMinutes="15" 
                            resizable="false" widgetVar="schdule" initialDate="#{bean.dates}" draggable="true" styleClass="#{bean.selDates}"
                             >
                             <p:ajax event="dateSelect" listener="#{bean.onDateSelect}"
                                update="dialogBox"  oncomplete="patScheduleDialog.show()"/>
                              <p:ajax event="eventSelect" listener="#{bean.onEventSelect}" 
                                update="dialogBox :form:growl" oncomplete="#{bean.pevent}"/>
                                <p:ajax event="eventMove" listener="#{bean.onEventMove}"
                                update="dialogBox, :form:growl" />
                        </p:schedule>

         <p:dialog id="dialogBox" header="Patient's Appointment Details" widgetVar="patScheduleDialog" resizable="true"  
                                 showEffect="explode" hideEffect="explode">  

                <h:panelGrid id="eventDetails" columns="2">  
            <h:outputLabel for="title" value="Title:" /> …
Run Code Online (Sandbox Code Playgroud)

primefaces jsf-2 tabview

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

PrimeFaces Tabview - 调整选项卡的宽度

我有一个左向的 Tabview。

在此处输入图片说明

我想减少标签标题的宽度,它们太大了。我怎样才能做到这一点?

<p:tabView orientation="left">
    <div style="width: 5%">
        <p:tab  title="Tab1">
        </p:tab>
        <p:tab title="Tab2">
            <p:dataTable id="dg_Diger"
                value="#{aboneGoruntulemeProvider.digerModel}" var="diger"
                style="margin-bottom:20px">
                <p:column headerText="Kart No">
                  <h:outputText value="#{diger.kartNo}" />
                </p:column>
                <p:column headerText="Alt Limit">
                  <h:outputText value="#{diger.altLimit}" />
                </p:column>
                <p:column headerText="Verili? Tarihi">
                  <h:outputText value="#{diger.verilisTarihi}" />
                </p:column>
                <p:column headerText="Biti? Tarihi">
                  <h:outputText value="#{diger.bitisTarihi}" />
                </p:column>
                <p:column headerText="Durum">
                  <h:outputText value="#{diger.durum}" />
                </p:column>
            </p:dataTable>
        </p:tab>
    </div>
</p:tabView>
Run Code Online (Sandbox Code Playgroud)

css jsf primefaces tabview jakarta-ee

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

TabView、tabItem:在选择时运行代码或添加 onTapGesture

当我在 tabview 中的选项卡之一被选中时,我想运行一些代码。

假设:我想创建一个应用程序,目的是:A) 使用 tabview 和 B) 严重混淆用户。为了实现这一点,我将创建一个带有“一”、“二”和“三”选项卡以及视图“一”、“二”和“三”的应用程序。然后,选择第二个选项卡时,我将改变视图“二”以说出“一个”。恶魔般的。

对此的常识解决方案是这样的:

import SwiftUI

struct ContentView: View {
    @State private var two : String = "Two"
    var body: some View {
        TabView() {
          Text("One")
            .tabItem {
              Text("One")
            }
          Text("Two")
            .tabItem {
              Text(two)
            }
              .onTapGesture {
                print("Tapped!!")
                self.two = "One"
              }
          Text("Three")
            .tabItem {
              Text("Three")
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,这与普通应用程序完全一样,并且无法混淆用户,因为两个未更新(并且控制台中没有“Tapped!”)。

选择或点击 tabItem 时如何运行代码?这可能是更新变量、运行动画或其他任何事情。

tabitem tabview swift swiftui

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

在 SwiftUI 的 TabView 中显示选定的选项卡

在 SwiftUI 中使用 TabView 时,如何才能显示选定的 Tab,如下图所示?

在此输入图像描述

我尝试在每个选项卡中创建一个 VStack,如下所示:

struct ContentView: View {
@State public var tabViewSelection = 0
var body: some View {
    TabView(selection: $tabViewSelection) {
        HomeFirstLevel()
            .tabItem {
                VStack {
                    Image("HomeIcon")
                    Rectangle()
                        .frame(height: 7)
                        .foregroundColor((tabViewSelection == 0) ? .black : .clear)
                }
            }.tag(0)
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但这不起作用。我什至似乎无法添加矩形而不是图像:

HomeFirstLevel()
   .tabItem {
       Rectangle()
   }.tag(0)
Run Code Online (Sandbox Code Playgroud)

TabView 不接受形状吗?先谢谢您的帮助!

tabview swiftui

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

SwiftUI TabView 重复第一个条目

Xcode RC 14.1

在此输入图像描述

第一个选项卡生成两次。第一个有效,第二个则显示空白屏幕。这已在 SO 的其他地方报道过,人们建议删除 Spacer(),但这没有什么区别。

下面的代码有两种变体,一种是标签的枚举,而不是整数,但它们的行为都是相同的。(不知道为什么下面所有的代码没有变成灰色?)

import SwiftUI


struct MenuView: View {
    
    private enum Tab: Hashable {
            case location
            case calculate
            case install
            case results
            case about
    }
    
    //  @State private var tabBarSelected: Tab = .location
    @State private var selectedTab = 0
    
    var body: some View {
        VStack {
            TabView(selection: $selectedTab) {
                LocationView()
                  //  .tag(Tab.location)
                    .tag(0)
                    .tabItem {
                        Text("Location")
                        Image(systemName: "globe.europe.africa")
                    }
                CalculateView()
                  //  .tag(Tab.calculate)
                    .tag(1)
                    .tabItem {
                        Text("Calculate")
                        Image(systemName: "apps.ipad")
                    }
                InstallView()
                    // .tag(Tab.install)
                    .tag(2)
                    .tabItem { …
Run Code Online (Sandbox Code Playgroud)

tabview swiftui swiftui-tabview

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

如何在 SwiftUI 中使用带有 NavigationView 的 TabView?

我遇到了与发布此问题的人完全相同的问题:

在 SwiftUI 中使用 TabView 时,NavigationView 无法正确显示

我做错了什么还是只是一个将被修复的 SwiftUI 错误?

tabview swift swift5 swiftui ios-navigationview

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

我如何在 SwiftUI 中创建带有顶部而不是底部的标题的 TabView

如何制作标题对齐顶部而不是底部的 SwiftUI TabView。

谢谢

tabview swiftui

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