2010-12-29 22 views
1

基本的に2つのTextViewsを持つ行を持つListViewがあります。しかし、これらのテキストビューの1つはHorizo​​ntalScrollView内にあります。行全体をハイライト表示する方法(Horizo​​ntalScrollViewを使用)

Iは、タッチモードで次の行動を望む:

1)ユーザがTextViewsのいずれかを押すと、行全体が強調表示されなければなりません。彼は最初のテキストビューを左右にスクロールできますが、行全体が強調表示されたままでなければなりません。

2)ユーザーが「プレス」を再評価した後、ユーザーは別の行を押すか、リストを上下にスクロールするまで、行をハイライト表示する必要があります。

ありがとうございます。

行レイアウト:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="?android:attr/listPreferredItemHeight" 
> 
    <HorizontalScrollView 
     android:id="@+id/frmclientes_listview_linha_scrollView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:gravity="center_vertical" 
     android:fillViewport="true" 
     android:scrollbars="none" 
     android:scrollbarAlwaysDrawHorizontalTrack="false" 
     android:scrollbarAlwaysDrawVerticalTrack="false" 
     android:fadingEdge="horizontal" 
     android:fadingEdgeLength="30sp" 
    > 
     <TextView 
      android:id="@+id/frmclientes_listview_line_firstline" 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:layout_alignParentTop="true" 
      android:ellipsize="marquee" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:gravity="center_vertical" 
      android:focusable="false" 
      android:lines="1" /> 
    </HorizontalScrollView> 

    <TextView 
     android:id="@+id/frmclientes_listview_line_secondline" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_below="@+id/frmclientes_listview_linha_scrollView1" 
     android:ellipsize="marquee" 
     android:gravity="center_vertical" 
     android:lines="1" 
     android:textAppearance="?android:attr/textAppearanceSmall" /> 

</RelativeLayout> 
+0

を上書きすることができるはずですか? –

答えて

0

あなたはHorizo​​ntalScrollViewの背景を変更していないのはなぜHorizontalScrollView.draw()

public class HorizontalScrollViewHighlight extends HorizontalScrollView { 
    public boolean isHighlighted = false; 
    public HorizontalScrollViewHighlight(Context context) { 
     super(context, null); 
    } 
    @Override 
    public void draw(Canvas canvas) { 
     super.draw(canvas); 
     if (isHighlighted) 
      // highlight code 
     else 
      // non-highlighted code 
    } 
} 
関連する問題