2011-06-20 6 views
2

ここは私のレイアウトxmlです。 私はカスタム背景を使用しています。私はこのコードの下に添付されています。 今私の問題はトラックボールが私のRelativelayout内で動作しない

のsettings.xml

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" android:background="#002288"> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/root" 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:isScrollContainer="true" 
     android:fitsSystemWindows="true" 
     android:gravity="top"> 
     <RelativeLayout android:id="@+id/RelativeLayout01" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="top"> 
      <TextView android:id="@+id/textView1" 
       android:layout_width="fill_parent" 
       android:layout_alignParentTop="true" 
       android:paddingTop="6dp" 
       android:paddingLeft="36dp" 
       android:background="@drawable/bar_plain" 
       android:layout_alignParentRight="true" 
       android:layout_height="30dp" 
       android:text="Settings" 
       android:textColor="#FFFFFF"> 
      </TextView> 
      <ImageView 
       android:id="@+id/ImageView01" 
       android:isScrollContainer="true" 
       android:layout_alignParentTop="true" 
       android:layout_height="30dp" 
       android:src="@drawable/appicon" 
       android:scaleType="fitStart" 
       android:layout_width="30dp"> 
      </ImageView> 
     </RelativeLayout> 
     <ScrollView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
      android:layout_below="@+id/textView1"> 
      <RelativeLayout 
       android:id="@+id/relativeLayout1" 
       android:layout_below="@+id/textView1" 
       android:layout_width="fill_parent" 
       android:paddingTop="10dp" 
       android:layout_height="fill_parent" 
       android:layout_centerVertical="true" 
       android:background="#002288"> 
       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageView1" 
        android:layout_alignParentLeft="true" 
        android:src="@drawable/icon"> 
       </ImageView> 
       <Button 
        android:id="@+id/button1" 
        android:layout_toRightOf="@+id/imageView1" 
        android:height="50dp" 
        android:layout_width="200dp" 
        android:layout_height="50dp" 
        android:textColor="#ffffff" 
        android:gravity="left|center_vertical" 
        android:textSize="20dp" 
        android:background="@drawable/button_selector" 
        android:text="@string/Display" 
        android:focusable="true"> 
       </Button> 
       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageView2" 
        android:layout_alignParentLeft="true" 
        android:src="@drawable/icon" 
        android:layout_below="@id/button1" 
        android:layout_marginTop="20dp"> 
       </ImageView> 
       <Button 
        android:id="@+id/button2" 
        android:layout_toRightOf="@+id/imageView2" 
        android:height="50dp" 
        android:layout_width="200dp" 
        android:layout_height="50dp" 
        android:textColor="#ffffff" 
        android:gravity="left|center_vertical" 
        android:textSize="20dp" 
        android:layout_below="@id/button1" 
        android:layout_marginTop="20dp" 
        android:background="@drawable/button_selector" 
        android:text="@string/compose" 
        android:focusable="true"> 
       </Button> 
       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageView3" 
        android:layout_alignParentLeft="true" 
        android:src="@drawable/icon" 
        android:layout_below="@id/button2" 
        android:layout_marginTop="20dp"> 
       </ImageView> 
       <Button 
        android:id="@+id/button3" 
        android:layout_toRightOf="@+id/imageView3" 
        android:height="50dp" 
        android:layout_width="200dp" 
        android:layout_height="50dp" 
        android:textColor="#ffffff" 
        android:gravity="left|center_vertical" android:textSize="20dp" android:layout_below="@id/button2" android:layout_marginTop="20dp" android:background="@drawable/button_selector" android:text="@string/Message" android:focusable="true"> 
       </Button> 
       <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView4" android:layout_alignParentLeft="true" android:src="@drawable/icon" android:layout_below="@id/button3" android:layout_marginTop="20dp"> 
       </ImageView> 
       <Button android:id="@+id/button4" android:layout_toRightOf="@+id/imageView2" android:height="50dp" android:layout_width="200dp" android:layout_height="50dp" android:textColor="#ffffff" android:gravity="left|center_vertical" android:textSize="20dp" android:layout_below="@id/button3" android:layout_marginTop="20dp" android:background="@drawable/button_selector" android:text="@string/New_SMS" android:focusable="true"> 
       </Button> 
       <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView5" android:layout_alignParentLeft="true" android:src="@drawable/icon" android:layout_below="@id/button4" android:layout_marginTop="20dp"> 
       </ImageView> 
       <Button android:id="@+id/button5" android:layout_toRightOf="@+id/imageView2" android:height="50dp" android:layout_width="200dp" android:layout_height="50dp" android:textColor="#ffffff" android:gravity="left|center_vertical" android:textSize="20dp" android:layout_below="@id/button4" android:layout_marginTop="20dp" android:background="@drawable/button_selector" android:text="@string/Privacy" android:focusable="true"> 
       </Button> 
      </RelativeLayout> 
     </ScrollView> 
    </LinearLayout> 
</ScrollView> 

button_sellector.xml

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <!-- pressed --> 
    <item android:state_pressed="true" > 
    <shape> 
     <stroke android:width="1px" android:color="#444" /> 
    <TextColor android:textColor="#000000"/> 
    <solid android:color="#FFEE33" /> 
    </shape> 
    </item> 
    <!-- focused --> 
    <item android:state_focused="true" > 
    <shape> 
     <stroke android:width="1px" android:color="#444" /> 
     <TextColor android:textColor="#000000"/> 
     <solid android:color="#FFEE33"/> 
    </shape> 
    </item> 

    <!-- default --> 
    <item> 
    <shape> 
     <solid android:color="#002288"/> 
     <stroke android:width="1px" android:color="#002288" /> 
    </shape> 
    </item> 

    <!-- -Scrolled --> 
    <item android:state_selected ="true" > 
    <shape> 
     <stroke android:width="1px" android:color="#444" /> 
     <TextColor android:textColor="#000000"/> 
     <solid android:color="#FFEE33"/> 
    </shape> 
    </item> 
</selector> 

答えて

1

あなたのコード..私は私を助けてtrackball.please使用するときにボタンにフォーカスを取得していないIAMされています正しく動作します。私はエミュレータでそれをテストしました。

関連する問題