fitting buttons for multiple screens

Posted by user3360327 on Stack Overflow See other posts from Stack Overflow or by user3360327
Published on 2014-03-23T12:21:54Z Indexed on 2014/06/13 3:26 UTC
Read the original article Hit count: 390

I want to develop my own keyboard and when I put first line button as you see the buttons are not fitting with any screens size. these are my questions:

1) how can I fit them?

2) is <TableLayout> is correct view layout? if it's not, which one is correct?

this is XML code:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TableRow>
        <Button
            android:id="@+id/btnQ"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strQ"
            />
        <Button
            android:id="@+id/btnW"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strW"
            />
        <Button
            android:id="@+id/btnE"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strE"
            />
        <Button
            android:id="@+id/btnR"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strR"
            />
        <Button
            android:id="@+id/btnT"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strT"
            />
        <Button
            android:id="@+id/btnY"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strY"
            />
        <Button
            android:id="@+id/btnU"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strU"
            />
        <Button
            android:id="@+id/btnI"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strI"
            />
        <Button
            android:id="@+id/btnO"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strO"
            />
        <Button
            android:id="@+id/btnP"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/strP"
            />
</TableLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about button