4
我想以編程方式做到這一點:有一定的風格創建ImageView的編程
<ImageView style="@style/TitleBarSeparator" />
其中TitleBarSeparator
是:
<style name="TitleBarSeparator">
<item name="android:layout_width">1px</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:background">@color/title_separator</item>
</style>
我已經試過:
new ImageView(getContext(), null, R.style.TitleBarSeparator);
但不起作用。 我想錯誤來自於傳遞null作爲AttributeSet
,但我不完全確定。