2014-12-23 4 views
-2

나는 TextViews를 사용하여 그룹으로 나뉘어 진 수백 개의 tablerow가있는 xml 파일을 가지고 있습니다.Textview에 연결하는 버튼을 설정하는 방법

버튼을 누르면 화면 상단에 버튼을 놓을 수 있으므로 해당 섹션으로 이동합니다. (사용자가 화면 아래로 스크롤하여 모든 관련 섹션을 표시하지 않고) html의 href와 같은 것.

업데이트 : 화면 상단의 버튼을 클릭 할 수 있기를 원하며 화면 아래쪽 절반의 텍스트가 있어야합니다.

예를 들어 마지막 TableRow로 점프 할 수 있도록 화면 상단에서 무언가를 클릭하고 싶습니다.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin"> 


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

    <TableRow 
     android:paddingTop="5dp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_marginStart="5dp" 
      android:layout_weight="3" 
      android:textSize="25sp" 
      android:text="@string/txt_color" 
      android:textColor="#890000" 
      android:height="45dp" 
      android:paddingTop="5dp" 
      android:paddingBottom="5dp" 
      android:textStyle="bold" /> 
     </TableRow> 
    <TableRow android:layout_marginTop="5dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:weightSum="9"> 

     <TextView 
      android:layout_width="0dp" 
      android:gravity="center" 
      android:layout_weight="3" 
      android:paddingTop="15dp" 
      android:paddingBottom="15dp" 
      android:text="@string/val_951" 
      android:textColor="#000000" 
      android:background="#ffffff" 
      android:layout_marginRight="5dp" 
      android:layout_marginStart="5dp" 
      android:layout_height="70dp"> 
     </TextView> 

     <TextView 
      android:text="@string/val_919" 
      android:textColor="#ffffff" 
      android:gravity="center" 
      android:paddingTop="15dp" 
      android:paddingBottom="15dp" 
      android:background="#f1b83a" 
      android:layout_height="match_parent" 
      android:layout_marginLeft="5dp" 
      android:layout_marginRight="5dp" 
      android:layout_weight="3" 
      android:layout_width="0dp"> 
     </TextView> 

     <TextView 
      android:text="@string/val_820" 
      android:textColor="#ffffff" 
      android:gravity="center" 
      android:paddingTop="15dp" 
      android:paddingBottom="15dp" 
      android:background="#990033" 
      android:layout_height="match_parent" 
      android:layout_marginLeft="5dip" 
      android:layout_marginRight="5dip" 
      android:layout_weight="3" 
      android:layout_width="0dp"> 
      </TextView> 
     </TableRow> 



    . 
    . 
    . 
    . 
    <TableRow> 
    etc etc 
    </TableRow> 

    </TableLayout> 
    </ScrollView> 
+0

질문을 사용하려고 클릭하지 않았 – Greg

답변

0

는 그것을 테스트하지만 버튼을 재 진술

myTextView.setSelected(true); 
관련 문제