问题描述
当前,我正在创建公交车票簿应用程序。在此应用程序中,我想将座椅设置为Webservice的响应。因此问题是,如果左侧一个卧铺座椅和右侧座椅坐席,那么我将如何布置座椅,如下图所示。
当前我正在使用gridview,但我不知道如何实现。
以及如何动态设置所有内容。请建议是否使用其他布局。
currently i am create bus ticket book application. in this application i want to set seat as came response of webservice .so problem is that if left side one sleeper seat and right side seater seat then how i arrange seat like below image.currently i am using gridview but i don't know how to achieve.and how to set all dynamically. please suggest if another layout used.
在我使用的一些代码下面
below some code that i used
seatLayout.xml
seatLayout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/seatLayoutScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottomBarSeatSelection"
android:background="@color/white" >
<RelativeLayout
android:id="@+id/scrollableLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/seatLegendLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5.0dip"
android:layout_marginTop="5.0dip"
android:background="@color/white" >
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/bus_seat_indicator_layout" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/seatLayoutLowerMain"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="@+id/seatLegendLayout"
android:layout_centerHorizontal="true"
android:paddingBottom="5.0dp"
android:paddingRight="5.0dp"
android:layout_marginTop="10.0dip">
<GridView
android:id="@+id/gridView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/driver"
android:layout_margin="4dp"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
android:columnWidth="90dp"
android:gravity="center"
android:stretchMode="columnWidth" >
</GridView>
<RelativeLayout
android:id="@+id/driver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginRight="20.0dp"
android:layout_marginBottom="5.0dp"
android:layout_alignRight="@+id/gridView1"
android:background="@drawable/steering_icon"
android:orientation="horizontal" >
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/seatLayoutUpper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/seatLegendLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="10.0dip"
android:visibility="invisible" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/bottomBarSeatSelection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/white" >
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/bus_seat_bottom_layout" />
</RelativeLayout>
</RelativeLayout>
使用此方法我会达到低于输出的水平
Using this i achieve below output
但是我不知道如何实现第一张图片。
but i don't have any idea how to achieve 1st image.
推荐答案
我也一直在寻找一些东西,但是要比这复杂一些。但是我认为该项目将帮助您解决当前的需求。看看这些:-
I also have been looking for something, but bit more complex than this. But I think this project will help you out with you current requirements. Check these out :-
和
让我知道是否有帮助。
更新:
尝试我的小技巧,以使用SVG图像实现任何形式的布局交互。
老实说,互动式座位图开发是我一生中最艰巨的任务。
Try my little hack to achieve any kind of layout interaction using SVG image.To be honest, an interactive seat map development was the most challenging task I have ever had in my development life. But somehow I have done it for an asymmetric seat plan.
这是我使之可行的方法。参见我的媒体发布。希望对您有所帮助。
Here is my approach to make it workable. See my medium blog post. Hope it will help you.
这篇关于如何动态设置座椅位置作为响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!