Android get layout parent id

前端 未结 4 954
粉色の甜心
粉色の甜心 2021-01-02 10:52

I would like to know what is the difference between View and ViewParent ? I am trying to get the Id of the parent of an ImageView but this I can\'t do :

4条回答
  •  情歌与酒
    2021-01-02 11:30

    You have to cast your parent view to a View, so you can use getId() method, using ((View) myImageView.getParent()).getId()

提交回复
热议问题