android - Value equals to match_parent or fill_parent in dimens.xml? -
based on here on xml attributes section specify following in dimens.xml:
<dimen name="match_parent">-1dp</dimen> <dimen name="main_left_menu_user_account_width">@dimen/match_parent</dimen> <dimen name="main_left_menu_user_account_height">@dimen/match_parent</dimen> then use both dimensions in layout:
<imageview android:id="@+id/useraccountimage" android:background="@drawable/user_account" android:layout_width="@dimen/main_left_menu_user_account_width" android:layout_height="@dimen/main_left_menu_user_account_height" /> then, when preview graphical layout, complains:
you must supply layout_width attribute.
you must supply layout_height attribute.
actually can define value equals match_parent in dimens.xml?
update:
i tried preview still complains:
<dimen name="main_left_menu_user_account_width">-1dp</dimen> <dimen name="main_left_menu_user_account_height">-1dp</dimen> i use wrap_content (the graphical layout doesn't complain @ all):
<dimen name="wrap_content">-2dp</dimen> <dimen name="main_right_menu_width">@dimen/wrap_content</dimen> <dimen name="main_right_menu_height">@dimen/wrap_content</dimen>
use this, works me
<dimen name="custom_wrap_content">-2dp</dimen> <dimen name="horizontal_border_height">@dimen /custom_wrap_content</dimen> <dimen name="custom_match_parent">-1dp</dimen> <dimen name="vertical_border_height">@dimen /custom_match_parent</dimen> and reason why match_parent doesn't run. you cannot supply build in keyword match_parent
Comments
Post a Comment