开发者

Buttons are hiding but not showing when focus is moving in Android

I have some odd requirement. I have some menu buttons.when i am clicking on the buttons some other 3 buttons should visible. But when the focus is moving to another menu button, this 3 buttons should hide or become invisible. i did the first requirement. But unable to do the second. I take the three buttons in a relative layout.

<RelativeLayout android:id="@+id/relativelayout_inventory"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@id/relativelayout_menu"
         android:layout_toRightOf="@id/relativelayout_checkout"
         android:layout_marginTop="10px"
         android:layout_marginLeft="18px"
         android:visibility="invisible"
   >
   <Button android:id="@+id/stckupdt"
        android:background="@drawable/stckupdt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
  >
  </Button>

  <Button android:id="@+id/pushoffer"
        android:background="@drawable/stckstatus"
 开发者_开发技巧       android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/stckupdt"
        android:layout_marginTop="10px"
  >
  </Button>
 </RelativeLayout>

And in the java file, i write the code like below..

final Button button_inventory = (Button)findViewById(R.id.inventory);
        final RelativeLayout view_inventory = (RelativeLayout)findViewById(R.id.relativelayout_inventory);
        button_inventory.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                view_inventory.setVisibility(View.VISIBLE);
            }
        });


So you are intend to do like Windows menu? I don't know why you need to do that on a phone, but you better look at Touch Event to OnClickListener: Handling UI Events

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜