Java 设计歌剧选座布局
我正在创建一个包含200多个座位的布局。它需要可缩放和可拖动(已经完成)。给我带来麻烦的是,有些座位是倾斜的,我不能很好地安排它们,这样它们就会对齐。 这就是我所要达到的目标: 这就是我希望它最终的样子: 我不知道如何解决的第二个问题是,我如何知道哪一排的座位和号码。我需要这个,这样我就可以预定座位了。现在我正在给他们分配ID,但这看起来不是个好主意 现在我正在xml中添加席位,这简直让我受不了。整个歌剧院有1000多个座位。有没有一种方法可以实用地添加它们(请注意,每一排的座位数不同)Java 设计歌剧选座布局,java,android,xml,Java,Android,Xml,我正在创建一个包含200多个座位的布局。它需要可缩放和可拖动(已经完成)。给我带来麻烦的是,有些座位是倾斜的,我不能很好地安排它们,这样它们就会对齐。 这就是我所要达到的目标: 这就是我希望它最终的样子: 我不知道如何解决的第二个问题是,我如何知道哪一排的座位和号码。我需要这个,这样我就可以预定座位了。现在我正在给他们分配ID,但这看起来不是个好主意 现在我正在xml中添加席位,这简直让我受不了。整个歌剧院有1000多个座位。有没有一种方法可以实用地添加它们(请注意,每一排的座位数不同) 将
将座位计划作为SVG不是更容易吗?从现在起我就没有听说过SVG。我肯定会更深入地了解这一点。您希望将每个座位放在单独的SVG中,还是将它们全部放在一个SVG中?全部放在一个SVG中,为每个座位提供一个ID,以便您可以单独引用它们来设置属性,如css类,以指示占用、空闲等。
<ZoomableRelativeLayout
android:id="@+id/first_floor_zoomablarelativelayout_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="54dp"
android:layout_marginTop="49dp">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:rotation="20">
<Button
android:id="@+id/button1"
style="@style/Button_Seat_Not_Occupied"
android:background="@drawable/button_seat_picker"
android:text="1"/>
<Button
android:id="@+id/button2"
style="@style/Button_Seat_Not_Occupied"
android:background="@drawable/button_seat_picker"
android:text="2"/>
<Button
android:id="@+id/button3"
style="@style/Button_Seat_Not_Occupied"
android:background="@drawable/button_seat_picker"
android:text="3"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/linearLayout"
android:orientation="horizontal">
<Button
android:id="@+id/button4"
style="@style/Button_Seat_Not_Occupied"
android:background="@drawable/button_seat_picker"
android:text="4"/>
<Button
android:id="@+id/button5"
style="@style/Button_Seat_Not_Occupied"
android:background="@drawable/button_seat_picker"
android:text="5"/>
<Button
android:id="@+id/button6"
style="@style/Button_Seat_Not_Occupied"
android:background="@drawable/button_seat_picker"
android:text="6"/>
</LinearLayout>
</RelativeLayout>
</ZoomableRelativeLayout>