标签: layout

使用Magento布局

最近我开始与Magento 1.6.1合作,为我在当地的一家电子商务公司担任新职位.我以前有过经验,但主要是使用Wordpress.

虽然我"知道"Magento并且可以围绕它如何运作,当然仍然存在障碍.幸运的是,我有一个足够好的老板让我在代码中弄脏手,并且每天都学到越来越多.

最近,布局一直是我的新障碍.问题是我在代码中工作,这些代码是由其他人或其他人修改代码完成的.我不是这里的第一个网站管理员......

我移动"bottom.phtml"块时遇到困难,因此它会在"media.phtml"下面呈现(产品图像/缩略图渲染的位置).代码如下:

    <catalog_product_view translate="label">
    <label>Catalog Product View (Any)</label>
    <!-- Mage_Catalog -->
    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="head">
        <action method="addJs"><script>varien/product.js</script></action>

        <action method="addJs"><script>virtualpaginate.js</script></action>

        <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
        <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
        <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>

    </reference>
    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            <!--
            <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/summary.phtml</template></action>
            <action method="addReviewSummaryTemplate"><type>short</type><template>review/helper/summary_short.phtml</template></action>
            <action method="addReviewSummaryTemplate"><type>...</type><template>...</template></action>
            -->
            <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
            <block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
                <label>Alert Urls</label>
            </block>

            <action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
            <block type="catalog/product_list_related" name="catalog.product.related" as="related" template="catalog/product/list/related.phtml"/>
            <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml">
                <action method="setColumnCount"><columns>4</columns></action>
                <action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
            </block>

            <block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" …
Run Code Online (Sandbox Code Playgroud)

xml layout themes magento

0
推荐指数
1
解决办法
5232
查看次数

ImageView尺寸错误

编辑:部分答案

例如,如果在xml中设置了两个维度,则其行为与预期相同

android:layout_width="250dp"
android:layout_height="250dp"
Run Code Online (Sandbox Code Playgroud)

如果留给wrap_content,则不会.

原帖

这是我的布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >

<ImageView
android:id="@+id/board"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/board" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

为什么我在屏幕上看到的图像具有正确的尺寸(屏幕高度x屏幕高度,因为它是方形位图,我设置match_parent为高度),但是如果我调用ImageView.getWidth()和ImageView.getHeight()它给了我屏幕尺寸?

最好的祝福

layout android

0
推荐指数
1
解决办法
2457
查看次数

Android中屏幕半宽的按钮

可能重复:
屏幕按钮半宽

我想在线性层(水平方向)内创建两个按钮,每个按钮具有屏幕的一半宽度,并且还有一点边距.我有这个xml布局:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/main"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/txtTitle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:paddingTop="5dp"
            android:text="@string/Title" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center|fill_horizontal"
            android:orientation="horizontal"
            android:padding="2dp" >

            <Button
                android:id="@+id/btnLeft"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:layout_weight="1"
                android:text="@string/LeftButton" />

            <Button
                android:id="@+id/btnRight"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:layout_weight="1" 
                android:text="@string/RightButton" />

        </LinearLayout>
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

好吧,所有这些代码都能完美地满足我的需求,但是我收到了关于我的两个按钮的警告.它说"嵌套权重对性能不利".我知道它是什么,但我不知道如何改变我的布局,以摆脱警告(并提高性能,我想)并保持两个按钮有一半的屏幕.

有任何想法吗?谢谢!

layout android button

0
推荐指数
1
解决办法
5310
查看次数

固定与流体与弹性布局与响应布局之间的差异是什么?

能否详细说明我之间的区别

固定与流体与弹性布局对比响应布局

html css layout css-float fluid-layout

0
推荐指数
1
解决办法
1439
查看次数

Android:surfaceView不能在onCreate()中使用getHolder(),必须在onResume()中

在我的活动中,我有一些观点和一个surfaceView.

这是我的第一个代码 onCreate()

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    upBtn = (Button) findViewById(R.id.upBtn);
    // and more widget here
    surface = (SurfaceView) findViewById(R.id.surfaceView);     
    this.holder = surface.getHolder(); // NullPointerException
    setContentView(R.layout.view);
Run Code Online (Sandbox Code Playgroud)

如果我通过take surfaceViewgetHolder()in 更改上面的代码onResume()(我已经多次尝试过这个结果),没有错误:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    upBtn = (Button) findViewById(R.id.upBtn);
    // and more widget here
    // surface = (SurfaceView) findViewById(R.id.surfaceView); //cancel     
    // this.holder = surface.getHolder(); // cancel
    setContentView(R.layout.view);
Run Code Online (Sandbox Code Playgroud)
public void onResume() {
    surface = (SurfaceView) findViewById(R.id.surfaceView);     
    this.holder = surface.getHolder(); // No Error …
Run Code Online (Sandbox Code Playgroud)

java layout android surfaceview surfaceholder

0
推荐指数
1
解决办法
3699
查看次数

android:layout_weight with vertical linearlayout

我正在尝试创建一个Android布局,如:

[####的EditText ###] [按钮]

[####列表显示#####]

为此,我正在使用重量,但下面的xml给了我一些非常类似的东西:

[EDITTEXT] [按钮] [ListView的]

有人知道为什么吗?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/background"
    android:weightSum="10"
     >

    <EditText android:id="@+id/nova_lista"
        android:inputType="text"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="9"
        android:hint="@string/new_list_hint">

    </EditText>

    <Button android:id="@+id/nova_lista_botao"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:text="@string/new_list"/>

    <ListView
        android:id="@+id/list_of_lists"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    </ListView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

xml layout android

0
推荐指数
1
解决办法
9730
查看次数

如何在kivy中设置网格布局的位置(x,y坐标)?

我注意到当你在Kivy中使用网格布局制作按钮时,它们是在(0,0)处创建的,并且根据前一个按钮的长度和宽度移动多个空格.但是,我想在屏幕底部中间有一个3x4网格.

到目前为止我有这个:

import kivy
from kivy.uix.gridlayout import GridLayout
from kivy.app import App
from kivy.uix.button import Button

class CalcApp(App):
    def build(self):
        layout = GridLayout(cols=3, row_force_default=True, row_default_height=50)
        layout.add_widget(Button(text='1', size_hint_x=None, width=100))
        layout.add_widget(Button(text='2', size_hint_x=None, width=100))
        layout.add_widget(Button(text='3', size_hint_x=None, width=100))
        layout.add_widget(Button(text='4', size_hint_x=None, width=100))
        layout.add_widget(Button(text='5', size_hint_x=None, width=100))
        layout.add_widget(Button(text='2', size_hint_x=None, width=100))
        layout.add_widget(Button(text='6', size_hint_x=None, width=100))
        layout.add_widget(Button(text='7', size_hint_x=None, width=100))
        layout.add_widget(Button(text='8', size_hint_x=None, width=100))
        layout.add_widget(Button(text='9', size_hint_x=None, width=100))
        layout.add_widget(Button(text='0', size_hint_x=None, width=100))
        layout.add_widget(Button(text='Enter', size_hint_x=None, width=100))
        return layout

CalcApp().run()
Run Code Online (Sandbox Code Playgroud)

那么,我该如何改变立场?

python grid layout button kivy

0
推荐指数
1
解决办法
6165
查看次数

如何在app小部件中设置Android AnalogClock的时间?

如何AnalogClock在app小部件中设置Android的自定义时间?

作为替代方案,我正在考虑覆盖默认的AnalogClock来设置代码的时间.换句话说,我会创建自定义时钟,它从默认的View或AnalogClock扩展.然后将我的自定义时钟放在小部件布局UI上.

这可能吗?我担心RemoteViews会限制我们自己的自定义组件.

更新: 这是错误日志我首先遵循vArDo给出的解决方案.

在此输入图像描述

layout android components widget android-appwidget

0
推荐指数
1
解决办法
6203
查看次数

在KeyPress上更改JTextField的大小

当用户在textfield中输入文本时,我必须在KeyPressed事件上扩展JTextField的大小.请给我一些想法如何实现这一点?

提前致谢

java graphics layout swing jtextfield

0
推荐指数
1
解决办法
1446
查看次数

Android:是否可以创建空心(空心)布局?

对不起,如果我的话题令人讨厌,我不确定用哪个词来描述我需要的布局.

目前我正在开发一个项目,需要在mapview上覆盖一个空心布局,空心布局将用于显示远距离定位点,我发布图像来演示我的意思.

Mapview与storke叠加

基本上整个屏幕由Mapview填充,叠加布局应覆盖它而不覆盖中心,就像我在图像中显示的那样.

这是xml显示我做了如上所述的布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<com.google.android.maps.MapView
android:id="@+id/MapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="..."
/>

   <View
   android:layout_width="320dip"
   android:layout_height="50dip"
   android:layout_gravity="center_horizontal|top"
   android:background="#800ff4ff"
   android:textColor="#ffffffff" />


 <View
    android:layout_width="320dip"
    android:layout_height="50dip"
    android:layout_gravity="center_horizontal|bottom"
    android:background="#800ff4ff"
    android:textColor="#ffffffff"
  />

<View
    android:layout_width="50dip"
    android:layout_height="520dip"
    android:layout_gravity="center_vertical|right"
    android:background="#800ff4ff"
    android:textColor="#ffffffff" />

 <View
    android:layout_width="50dip"
    android:layout_height="520dip"
    android:layout_gravity="center_vertical|left"
    android:padding="20dip"
    android:background="#800ff4ff"
    android:textColor="#ffffffff" />

</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

我使用framelayout来允许布局覆盖其他布局,并在每个边缘创建4个sepreate来模拟我真正想要的东西(空心).我只是不确定是谁让布局只显示4边并保持中心隐形,如果任何人可以帮助请给我一些指导.谢谢.

layout android

0
推荐指数
1
解决办法
2978
查看次数