나는 5 개의 탭이있는 TabWidget
이 있습니다. 탭 : "1", "2", "3", "4", "5". 은 HorizontalScrollView
입니다. 이제 각 방향에 하나의 화살표 (< 및>)가 표시되어 해당 방향으로 더 많은 탭이 있음을 나타냅니다 (보기에는 현재 보이지 않음). 첫 번째 탭은 다음 현재보기에 (를 화살표가 표시되어야합니다 (<)를 왼쪽으로 마지막 탭이 표시되지 않는 경우 (현재보기에 ) 보이지 않는 경우TabWidget의 특정 "탭"이 현재보기에서 표시되는지 여부를 확인할 수 있습니까?
지금 내가하고 싶은 것입니다) 오른쪽 화살표가 표시되어야하고 두 탭이 모두 보이지 않으면 (현재보기에 ) 두 화살표가 모두 표시되어야합니다. 내 두 탭은 시작에 보이지 않는,
if (horizontablscrollview.getLeft == 0)
{
arrowRight.setVisiblity(View.VISIBLE)
arrowLeft.setVisiblity(View.INVISIBLE)
}
else if(horizontablscrollview.getRight == 0)
{
arrowLeft.setVisiblity(View.VISIBLE)
arrowRight.setVisiblity(View.INVISIBLE)
}
else if (horizontablscrollview.getRight == 0 && horizontablscrollview.getLeft == 0)
{
arrowRight.setVisiblity(View.VISIBLE)
arrowLeft.setVisiblity(View.VISIBLE)
}
하지만이 작동하지 않습니다 : 나는 함께 그 일을 시도
이내 XML은 다음과 같습니다 ..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff" >
<RelativeLayout
android:id="@+id/RL_Header"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_marginBottom="3dip"
android:background="@drawable/gradient" >
<ImageButton
android:id="@+id/btn_Home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:background="@android:color/transparent"
android:contentDescription="@string/description_home"
android:onClick="onHomeButtonClick"
android:src="@drawable/title_home" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip"
android:background="@android:color/transparent"
android:contentDescription="@string/description_about"
android:onClick="onClickAbout"
android:src="@drawable/title_about" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/FL_Tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/RL_Header" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/FL_Tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/RL_Header" >
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff" >
<ImageView android:id="@+id/arrow_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/i_button"
android:layout_alignParentLeft="true"/>
<RelativeLayout
android:id="@+id/rl_tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView android:id="@+id/arrow_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/i_button"
android:layout_alignParentLeft="true"
android:visibility="invisible"/>
<ImageView android:id="@+id/arrow_Right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/i_button"
android:layout_alignParentRight="true"
android:visibility="invisible"/>
<HorizontalScrollView
android:id="@+id/my_scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
android:layout_toRightOf="@+id/arrow_left"
android:layout_toLeftOf="@+id/arrow_Right">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:tabStripEnabled="true"/>
</HorizontalScrollView>
</RelativeLayout>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="65dip" >
<RelativeLayout
android:id="@+id/myTabContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dip" >
<TableLayout
android:id="@+id/tabSubs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="20dip"
android:gravity="center_horizontal" >
<Button
android:id="@+id/btntestno1"
android:layout_weight="1"
android:gravity="center"
android:padding="20dip"
android:text="Test 1"
android:textColor="#000000" />
<Button
android:id="@+id/btntestno2"
android:layout_weight="1"
android:gravity="center"
android:padding="20dip"
android:text="Test 2"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:gravity="center_horizontal" >
<Button
android:id="@+id/btntestno3"
android:layout_weight="1"
android:gravity="center"
android:padding="20dip"
android:text="Test 3"
android:textColor="#000000" />
<Button
android:id="@+id/btntestno4"
android:layout_weight="1"
android:gravity="center"
android:padding="20dip"
android:text="Test 4"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:gravity="center_horizontal" >
<Button
android:id="@+id/btntestno5"
android:layout_weight="1"
android:gravity="center"
android:padding="20dip"
android:text="Test 5"
android:textColor="#000000" />
<Button
android:id="@+id/btntestno6"
android:layout_weight="1"
android:gravity="center"
android:padding="20dip"
android:text="Test 6"
android:textColor="#000000" />
</TableRow>
</TableLayout>
</RelativeLayout>
</FrameLayout>
</TabHost>
</RelativeLayout>
</RelativeLayout>
하나를 도와 주시면 대단히 감사하겠습니다.
당신이 여기에 올린 코드는 내가 원하는 것에 가깝지만 의도적으로 작동하지 않습니다. 나는이 새로운 일종의이며 올바르게 작동하도록 코드를 조작하는 방법을 모르겠다. 그것이 작동하도록하기 위해 당신이 그것을 조사 할 수 있다면 그것은 나의 요구이다. 나는 크게 감사 할 것이다. 그리고 그 문제를 유감스럽게 생각합니다. – ark
@ user1395649 당신은 내 코드가 지금 어떻게 작동하고 어떻게 대신 일하고 싶었는지 언급해야합니다.나는 마음을 읽을 수 없다 :) – Luksprog
롤 죄송합니다, 무슨 일이 나는 극단적 인 권리를 스크롤 할 때, 왼쪽 화살표 (보이게 될 예정이다)가 보이지 않게되고 오른쪽 (사라져야한다)이 거기에 머무르게됩니다. 가운데 부분 (화살표가 모두 보일 곳)은 완벽하게 작동합니다. 이제 오른쪽에서 극한의 왼쪽으로보기를 스크롤하면 오른쪽과 왼쪽의 두 화살표가 그대로 남아 있습니다 (극단적 인 왼쪽에있을 때 왼쪽이 사라져야 함). 나는 내가 여기에 없다면 이것을 정확하게 설명하기를 바랍니다. 빠른 회신을 주셔서 감사합니다 (: – ark