<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants" >
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tock_on"
android:focusable="false"
android:layout_weight="1"
android:background="@drawable/tock_on"
android:layout_gravity="center_vertical"
afterDescendants:viewgroup 及其子类控件都不能回去焦点
blocksDescendants:viewgroup先获得焦点,选中后子类才能获取焦点。如何让其子类控件先获取焦点呀
Java代码
final GridView dev_list = (GridView) findViewById(R.id.dev_list);
`dev_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final ImageButton tock_on = (ImageButton) dev_list.findViewById(R.id.tock_on);
tock_on.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Toast.makeText(getApplicationContext(), "开始说话",Toast.LENGTH_SHORT).show();
tock_on.setBackgroundResource(0);
tock_on.setBackgroundResource(R.drawable.tock_on_btn);
tock_off.setBackgroundResource(0);
tock_off.setBackgroundResource(R.drawable.tock_off_btn);
}
});
});