마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

tabwidget 에러 해결바어법좀 알려주세요 ㅠㅠ

0 추천
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.user.myapplication.MainActivity">

    <TabHost
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/tabhost">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/tabcontent"
                android:layout_weight="1">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/content1"
                    android:orientation="vertical">
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/home"
                        android:gravity="center"
                        android:textSize="34dp"
                        android:padding="5dp"
                        android:background="@color/song"/>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/content2"
                    android:orientation="vertical">
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/call"
                        android:gravity="center"
                        android:textSize="34dp"
                        android:padding="5dp"
                        android:background="@color/song"/>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/content3"
                    android:orientation="vertical">
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/board"
                        android:gravity="center"
                        android:textSize="34dp"
                        android:padding="5dp"
                        android:background="@color/song"/>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/content4"
                    android:orientation="vertical">
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/setting"
                        android:gravity="center"
                        android:textSize="34dp"
                        android:padding="5dp"
                        android:background="@color/song"/>
                </LinearLayout>

            </FrameLayout>

            <TabWidget
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/android.R.id.tabs"
                android:orientation="vertical"/>

        </LinearLayout>

    </TabHost>



</LinearLayout>

RuntimeException: Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs

 

이렇게 뜨네요 ㅠㅠㅠ

그래서 TabWidget 이름을 tab 도 해보고 android.R.id.tabs 도하고 @android:id/tabs 다햇느데 안됩니다 ㅠㅠㅠ알려주세요

익명사용자 님이 2017년 11월 17일 질문

1개의 답변

+1 추천

<FrameLayout은 

android:id="@android:id/tabcontent"

<TabWidget은 

android:id="@android:id/tabs"

이렇게 변경해보세요

 

 

 

yuhyeon (420 포인트) 님이 2017년 11월 28일 답변
정말 감사합니다. 왜 추천과 채택이 안되어있는지 궁금하네요.
...