0

I have seen an issue while designing dashboard screen, I had one layout : say Linearlayout1 and having scroll layout: say scrollLayout1 as child of Linearlayout1, and havinf Table layout under this scroll layout, i added table rows which contains buttons with drawables. now the question is> I can see, table layout height is bit more than the scroll layout which is child of scroll layout. how child layout can have more height then parent layout. (I set table layout height as matchparent or fill parent).

AAnkit
  • 27,299
  • 12
  • 60
  • 71

2 Answers2

1

If you are building a dashboard, then use the DashboardLayout from Google IO open source app. That is the best way to do it. If you are planning to do something manually, it may not be possible to test on all the screen sizes, densities.

I used it in 3 of my projects, which just works.

Check this answer on stackoverflow.

Community
  • 1
  • 1
Gopinath
  • 12,981
  • 6
  • 36
  • 50
  • Even Facebook uses Google IO dashboard. Explained here: http://www.androidhive.info/2011/12/android-dashboard-design-tutorial/ – Gopinath Feb 14 '12 at 12:45
0

Try This it may helps you

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >   

    <RelativeLayout
          android:id="@+id/toplayout"
          android:layout_width="fill_parent"
          android:layout_height="50dip">
            <TextView 
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"     
             android:text="TopBar"/>
    </RelativeLayout>

    <ScrollView 
          android:id="@+id/scrolllayout"
          android:layout_width="fill_parent"
          android:layout_height="150dip"
          android:padding="5dip"
          >
      <RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal">

  <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="1"
    android:padding="5dip"
    android:background="@android:color/darker_gray">

    <TableRow>
        <TextView
            android:layout_column="1"
            android:text="Open..."
            android:textColor="#FFFFFF"
            android:padding="3dip" />
        <TextView
            android:text="Ctrl-O"
            android:gravity="right"
            android:textColor="#FFFFFF"
            android:padding="3dip" />
    </TableRow>

    <TableRow>
        <TextView
            android:layout_column="1"
            android:text="Save..."
            android:textColor="#FFFFFF"
            android:padding="3dip" />
        <TextView
            android:text="Ctrl-S"
            android:gravity="right"
            android:textColor="#FFFFFF"
            android:padding="3dip" />
    </TableRow>

    <TableRow>
        <TextView
            android:layout_column="1"
            android:text="Save As..."
            android:textColor="#FFFFFF"
            android:padding="3dip" />
        <TextView
            android:text="Ctrl-Shift-S"
            android:gravity="right"
            android:textColor="#FFFFFF"
            android:padding="3dip" />
    </TableRow>

    <View
        android:layout_height="2dip"
        android:background="#FF909090" />

    <TableRow>
        <TextView
            android:text="X"
            android:textColor="#FFFFFF"
            android:padding="3dip" />
        <TextView
            android:text="Import..."
            android:textColor="#FFFFFF"
            android:padding="3dip" />
    </TableRow>

    <TableRow>
        <TextView
            android:text="X"
            android:textColor="#FFFFFF"
            android:padding="3dip" />
        <TextView
            android:text="Export..."
            android:textColor="#FFFFFF"
            android:padding="3dip" />
        <TextView
            android:text="Ctrl-E"
            android:gravity="right"
            android:textColor="#FFFFFF"
            android:padding="3dip" />
    </TableRow>

    <View
        android:layout_height="2dip"
        android:textColor="#FFFFFF"
        android:background="#FF909090" />

    <TableRow>
        <TextView
            android:textColor="#FFFFFF"
            android:layout_column="1"
            android:text="Quit"
            android:padding="3dip" />
    </TableRow>
    </TableLayout>
    </RelativeLayout>
    </ScrollView>   
</LinearLayout>
Ajay
  • 4,850
  • 2
  • 32
  • 44