每当我使用Android Studio的Vector资源创建带有图标的ImageView时,我就会收到错误 app:srcCompat="@drawable/ic_play"
当我改变app:srcCompat
时android:src
,错误消失但图标看起来像素化.
两者之间的主要区别是什么
app:srcCompat="@drawable/ic_play"
Run Code Online (Sandbox Code Playgroud)
和
android:src="@drawable/ic_play"
Run Code Online (Sandbox Code Playgroud) 不知道为什么这么难.如果我理解这正确的,我应该能够迅速完成我的目标......但没有喜悦.
所以 - 我正在构建我的第一个主题,并且仍然围绕布局......
我正专门在Catalog Product View
页面上工作,并且正在将此页面从右列布局转换为左列布局.我只是想把块从右边移到左边.
在默认的catalog.xml中,product_list_related
定义了:
</catalog_product_view>
//...
<reference name="right">
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
</reference>
</catalog_product_view>
Run Code Online (Sandbox Code Playgroud)
在我的local.xml中,我只是想移动这个块:
<layout>
// bunch other page directives
<catalog_product_view>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="right">
<action method="unsetChild"><name>catalog.product.related</name></action>
</reference>
<reference name="left">
<action method="insert"><blockName>catalog.product.related</blockName></action>
// note that that "catalog.leftnav" gets inserted as expected
<block type="catalog/layer_view" name="catalog.leftnav" after="-" template="catalog/layer/view.phtml"/>
</reference>
</catalog_product_view>
</layout>
Run Code Online (Sandbox Code Playgroud)
如上所述 - 插入catalog.leftnav
按预期工作,所以我假设其他所有设置都正确.如果我保持模板和其他指令不变,目标块将按预期呈现,这告诉我块一旦被正确设置并插入就应该呈现...
这让我疯狂......但Magento还有什么新东西.
干杯 -
B []×
UPDATE
Run Code Online (Sandbox Code Playgroud)
因为我根本无法获得local.xml
覆盖工作,所以我只是回过头来修改catalog.xml
.我是一个相当聪明的人...它让我担心我不能让这个工作(而且无论如何,那个magento都默默地失败了) …
我希望在后端重用某个前端UI元素(在"design/adminhtml"下).这主要包括重用模板(phtml).但是,从后端引用前端布局句柄似乎更好.magento是否为共享UI组件提供了一个位置,一种将它们声明为共享的方式,或者是一种在前端/ adminhtml鸿沟中引用它们的机制?谢谢
我想为水平ProgressBar编写自定义样式.
如果要添加水平ProgressBar,则需要引用系统样式,如下所示:
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
我为它添加了一些自定义样式,添加了一些父级,但由于已经有一个样式引用使其具有水平形状,我需要继承此系统样式.
我试过这样的:
<style name="itemViewProgressBar" parent="@android:attr/progressBarStyleHorizontal">
<item name="android:paddingLeft">@dimen/ivProgressBarPaddingLeft</item>
<item name="android:paddingRight">@dimen/ivProgressBarPaddingRight</item>
<item name="android:paddingTop">@dimen/ivProgressBarPaddingTop</item>
<item name="android:paddingBottom">@dimen/ivProgressBarPaddingBottom</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在ProgressBar中我引用它是这样的:
<ProgressBar
android:id="@+id/progressBar1"
style="@style/itemViewProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
样式xml没有给我任何错误,所以引用似乎工作正常.但它仍然对ProgressBar没有任何影响.它看起来像我离开parent
属性一样(即它显示循环ProgressBar).
我当然可以在ProgressBar
元素本身中定义所有填充,并在ProgressBar中引用系统样式,如默认值.但更优雅的方式应该是使用自定义样式,特别是因为我需要经常重复使用它.
有关如何实现系统水平ProgressBar样式和自定义样式的自定义填充的任何想法?