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

horizontalscrollview 스크롤 안됨 문제 질문드립니다 [closed]

0 추천

제가 tabhost를 사용중인데 

탭 위젯을 추가하다보니 화면 크기보다 위젯 크기가 더 커서 horizontalscrollview 를 이용해 좌우로 스크롤 할수있도록 디자인 할려고하는데 

horizontalscrollview가 정상적으로 좌우로 스크롤이 안되서 이렇게 질문드립니다 .

tabhost.xml

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

    <HorizontalScrollView
        android:id="@+id/HorizontalScroll"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scrollbars="horizontal"
        android:fillViewport="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:weightSum="4"
            >

        </TabWidget>
        </LinearLayout>
    </HorizontalScrollView>



    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="match_parent"
        android:layout_height="602dp"

        >

        <LinearLayout
            android:id="@+id/tab1"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ListView
                android:id="@+id/koreafood"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            </ListView>
        </LinearLayout>

      
tabhost.java
@SuppressWarnings("deprecation")
public class foodtabhost extends TabActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.foodtabhost);
        TabHost tabHost = getTabHost();


        TabHost.TabSpec korea=tabHost.newTabSpec("korea").setIndicator("한식");
        korea.setContent(R.id.tab1);
        tabHost.addTab(korea);

        TabHost.TabSpec china=tabHost.newTabSpec("china").setIndicator("중국집");
        china.setContent(R.id.tab2);
        tabHost.addTab(china);

        TabHost.TabSpec chiken=tabHost.newTabSpec("chiken").setIndicator("치킨");
        chiken.setContent(R.id.tab3);
        tabHost.addTab(chiken);
질문을 종료한 이유: horizontalscrollview 위 부분부터 LinearLayout으로 감싸니 해결됨
kane9529 (1,110 포인트) 님이 2019년 9월 4일 질문
kane9529님이 2019년 9월 4일 closed
...