简体   繁体   English

Android TableLayout Manager

[英]Android TableLayout Manager

I am using a tableLayout for this application and I am trying to have it look like this 我正在为此应用程序使用tableLayout,我试图使其看起来像这样

http://i698.photobucket.com/albums/vv350/hoosierfan24/appLayout.png http://i698.photobucket.com/albums/vv350/hoosierfan24/appLayout.png

however I cant get it to look like that, and that is my problem. 但是我无法让它看起来像那样,这就是我的问题。 When I attempt to add a second button into the first row, the button is placed underneath the other button not along side of it. 当我尝试将第二个按钮添加到第一行时,该按钮位于另一个按钮的下方,而不是其侧面。 How can I change it to make the button appear along side the other? 如何更改它以使按钮与其他按钮并排出现?

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

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:stretchColumns="*">

    <TableRow>
        <Button android:marqueeRepeatLimit="marquee_forever"
            android:layout_height="74dp" android:id="@+id/button1"
            android:visibility="visible" android:text="Next Picture"
            android:linksClickable="true" android:background="@raw/arrow"
            android:layout_width="122dp"></Button>

            <Button android:marqueeRepeatLimit="marquee_forever"
            android:layout_height="74dp" android:id="@+id/button3"
            android:visibility="visible" android:text="xxxx"
            android:linksClickable="true" android:background="@raw/arrow2"
            android:layout_width="122dp"></Button>

    </TableRow>

    <TableRow>
        <ImageView android:id="@+id/imageView1"
            android:keepScreenOn="true" android:src="@raw/img1"
            android:layout_height="328sp" android:layout_width="323sp"
            android:hapticFeedbackEnabled="false"></ImageView>
    </TableRow>

    <TableRow>
        <Button android:text="Previous Picture" android:onClick="prevPicHandler"
            android:marqueeRepeatLimit="marquee_forever" android:linksClickable="true"
            android:visibility="visible" android:background="@raw/arrow2"
            android:layout_width="122dp" android:layout_height="74dp"
            android:id="@+id/button2"></Button>
    </TableRow>
</TableLayout>

I think for this you should use LinearLayouts instead. 我认为为此,您应该改用LinearLayouts。 Like this: 像这样:

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent" android:layout_height="fill_parent"
  android:orientation="vertical">

    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
        <Button android:marqueeRepeatLimit="marquee_forever"
        android:layout_height="74dp" android:id="@+id/button1"
        android:visibility="visible" android:text="Next Picture"
        android:linksClickable="true" android:background="@raw/arrow"
        android:layout_width="122dp"></Button>

        <Button android:marqueeRepeatLimit="marquee_forever"
        android:layout_height="74dp" android:id="@+id/button3"
        android:visibility="visible" android:text="xxxx"
        android:linksClickable="true" android:background="@raw/arrow2"
        android:layout_width="122dp"></Button>

    </LinearLayout>


    <ImageView android:id="@+id/imageView1"
        android:keepScreenOn="true" android:src="@raw/img1"
        android:layout_height="328sp" android:layout_width="323sp"
        android:hapticFeedbackEnabled="false"></ImageView>


    <Button android:text="Previous Picture" android:onClick="prevPicHandler"
        android:marqueeRepeatLimit="marquee_forever" android:linksClickable="true"
        android:visibility="visible" android:background="@raw/arrow2"
        android:layout_width="122dp" android:layout_height="74dp"
        android:id="@+id/button2"></Button>

</LinearLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM