Android: can height of SlidingDrawer be set with wrap_content?

后端 未结 6 2087
花落未央
花落未央 2020-11-27 10:38

I\'m trying to implement a SlidingDrawer that will occupy the full screen width, but whose height is determined dynamically by its contents: in other words, sta

6条回答
  •  遥遥无期
    2020-11-27 11:18

    seydhe's answer has a small issue.

    The first argument to the getAttributeIntValue needs to be the full namespace, not just "android". So the code snippet should be:

    final String xmlns="http://schemas.android.com/apk/res/android";
    int orientation = attrs.getAttributeIntValue(xmlns, "orientation", SlidingDrawer.ORIENTATION_VERTICAL);
     mTopOffset = attrs.getAttributeIntValue(xmlns, "topOffset", 0);
    

    I was having trouble getting this to work with a horizontal sliding drawer until I realized that it was not finding the orientation attribute and was therefore treating it as vertical.

提交回复
热议问题