当前位置:网站首页>Adapt to the pits in Huawei models

Adapt to the pits in Huawei models

2022-06-21 08:36:00 WCanTouch

First of all, let me roast about the compatibility of Huawei machines Bad , If the full score is 10 If you divide up , At most 3 branch .

1. The most common Huawei models are listview Click no response ;

          This is because if item.xml includes button perhaps checkbox Other controls , By default list Of item You lose focus , It's not responding item Events , The most common solution is to tem.xml In the layout file of descendantFocusability attribute .

 

 beforeDescendants:viewgroup Takes precedence over its subclass controls to get focus

 afterDescendants:viewgroup Get focus only when its subclass control doesn't need to get focus  

 blocksDescendants:viewgroup Will override the subclass control and get the focus directly

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="50dp"
 android:orientation="horizontal"
 android:descendantFocusability="blocksDescendants"><!-- Add this property -->

<checkBox>...
<Button>...

</LinearLayout>

If you encounter other problems later, continue to add ... To be continued

原网站

版权声明
本文为[WCanTouch]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206210832426096.html