0

So i'm getting an @string error as well as an API level error. Any suggestions? ive tried changing the xmlns, but still nothing to get rid of the error.

<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:columnCount="2"
android:orientation="horizontal" >

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/News" >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="Workouts" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Videos" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Blog" />
</Button>

paulsm4
  • 114,292
  • 17
  • 138
  • 190
A-P
  • 41
  • 7

1 Answers1

2

A Button is a view and canot be used as ViewGroup. You put 3 Buttons inside a Button node, it's not correct.

But in your words, you meet the api level error. GridLayout is added since API level 14 and cannot be used in lower level. You should add support library to enable it, try to read the same question for answer.

Community
  • 1
  • 1
faylon
  • 7,360
  • 1
  • 30
  • 28