简体   繁体   中英

android: How to achieve space on the top above the tablelayout(between screen and tablelayout)

I am not able to upload the image to help me better.

How to acheive space on the top of the tablelayout (ie)between the screen and the tablelayout. The table below is beginning without any space between the table and screen.

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/my_shape_file"
android:layout_alignParentRight="true" 
android:layout_marginTop="10dip"
android:stretchColumns="3">

 <TableRow>

        <TextView
            android:layout_column="1"
            android:gravity="left"            
            android:background="@drawable/todayhr"/>


        <TextView
            android:layout_column="2"
            android:text="one"
            android:gravity="center"
            android:textColor="#000000" />
    </TableRow>



  <View
    android:layout_height="1dip"
    android:layout_width="wrap_content"
    android:background="#ABABAB" />

  <tablerow>
  .................
    ........

Margins for a view are used by its container to position the view itself. Just include the TableLayout in a LinearLayout, and the latter will correctly add the margin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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