草庐IT

android - 将闪烁添加到自定义 ListView 项目?

coder 2023-11-23 原文

我创建了一个包含多个项目的 listview,并且我为这些项目添加了边框,因此它看起来像这样:

由于这个自定义边框,项目的原始闪烁被阻止,所以它不会出现,我试图通过动画添加闪烁,但延迟太多,主线程上的工作太多,我还在线程内使用了动画,但它与延迟的事情相同,这迫使我忘记了动画所以无论如何我可以在不使用动画或使用它但以有效的方式点击它时使它闪烁我在 onItemClickListener 中使用闪烁动画的方式你可以在下面的代码中找到它: onItemClickListener 处理闪烁:

dataList.setOnItemClickListener(new OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> arg0, final View arg1,
                        final int arg2, long arg3) {
                    // TODO Auto-generated method stub
                    tvWarningNoEmp.setVisibility(View.GONE);
                    // adding blink

                                final Animation animation = new AlphaAnimation(
                                        1, 0); // Change
                                // alpha
                                // from
                                // fully
                                // visible
                                // to
                                // invisible
                                animation.setDuration(100); // duration - half a
                                                            // second
                                animation
                                        .setInterpolator(new LinearInterpolator()); // do
                                // not
                                // alter
                                // animation
                                // rate
                                animation.setRepeatCount(Animation.INFINITE); // Repeat
                                // animation
                                // infinitely
                                animation.setRepeatMode(Animation.REVERSE);
                                arg1.startAnimation(animation);
                                // blink one time timer
                                new CountDownTimer(100, 100) {// CountDownTimer(edittext1.getText()+edittext2.getText())
                                                                // also parse it to long

                                    public void onTick(long millisUntilFinished) {

                                        // here you can have your logic to set text to
                                        // edittext
                                    }

                                    public void onFinish() {
                                        arg1.clearAnimation();
                                    }
                                }.start();



                                // set margins for tickets buttons
                                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                                        LayoutParams.WRAP_CONTENT,
                                        LayoutParams.WRAP_CONTENT);
                                params.setMargins(0, 0, 30, 0);
                                bAssign.setLayoutParams(params);
                                LinearLayout.LayoutParams paramsO = new LinearLayout.LayoutParams(
                                        LayoutParams.WRAP_CONTENT,
                                        LayoutParams.WRAP_CONTENT);
                                paramsO.setMargins(110, 0, 0, 0);
                                bEmpChat.setLayoutParams(paramsO);
                                noEmpLayout.setVisibility(LinearLayout.GONE);
                                empLayout.setVisibility(LinearLayout.VISIBLE);
                                Employee item = adapter.getItem(arg2);
                                ivEmpIcon.setBackgroundResource(R.drawable.free);
                                tvEmpName.setText(" " + item.getEmpName());
                                tvEmpDetails.setText(" " + item.getEmpDetails());
                                empLongitude = item.getEmpLongitude();
                                empLatitude = item.getEmpLatitude();
                                CameraPosition cameraPosition = new CameraPosition.Builder()
                                        .target(new LatLng(empLatitude, empLongitude))
                                        .zoom(15).build();
                                googleEmpMap.animateCamera(CameraUpdateFactory
                                        .newCameraPosition(cameraPosition));
                                MarkerOptions marker = new MarkerOptions().position(
                                        new LatLng(empLatitude, empLongitude)).title(
                                        tvEmpName.getText().toString());
                                marker.icon(BitmapDescriptorFactory
                                        .defaultMarker(BitmapDescriptorFactory.HUE_RED));
                                googleEmpMap.addMarker(marker);
                                // based on item add info to intent
                                // hide button directions
                                bEmpDirections.setVisibility(View.GONE);
                                // current address
                                Geocoder geocoder;
                                List<Address> addresses;
                                geocoder = new Geocoder(getApplicationContext(), Locale
                                        .getDefault());
                                try {
                                    addresses = geocoder.getFromLocation(empLatitude,
                                            empLongitude, 1);
                                    String street = addresses.get(0).getAddressLine(0);
                                    String state = addresses.get(0).getAdminArea();
                                    String country = addresses.get(0).getCountryName();
                                    tvEmpCurrentAdd.setText(" " + country + "-" + state
                                            + "-" + street + " st.");
                                } catch (IOException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();}





                }

            });

ListView 布局:

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
<LinearLayout
   android:layout_width="match_parent"
        android:layout_height="wrap_content"
    >
        <Button
            android:id="@+id/btnBack"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:background="@drawable/back" />

        <TextView
            android:id="@+id/tvWarningNoEmp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="choose an employee from here to assign this problem to!"
            android:textColor="#FF0000" 
            android:layout_marginLeft="400dp"
            android:visibility="gone"/>

</LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="40dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"

                android:layout_weight="2"
                android:background="@drawable/pepsiborder"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/blueborder"
                    android:orientation="horizontal"
                    android:padding="10dp" >

                    <ImageView
                        android:id="@+id/TicketIcon"
                        android:layout_width="60dp"
                        android:layout_height="60dp"
                        android:layout_gravity="center_vertical"
                        android:layout_weight="0.1" />

                    <LinearLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_weight="0.7"
                        android:gravity="center_vertical"
                        android:orientation="vertical" >

                        <TextView
                            android:id="@+id/ticketCat"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="7dp"
                            android:gravity="center_vertical"
                            android:textColor="#D3D9FF"
                            android:textSize="17sp" />
                    </LinearLayout>
                </LinearLayout>

                <fragment
                    android:id="@+id/ticketMap"
                    android:name="com.google.android.gms.maps.MapFragment"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp" />

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:orientation="vertical" >

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/textView2"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="State:"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#D3D9FF" />

                        <TextView
                            android:id="@+id/ticketState"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text=""
                            android:textColor="#D3D9FF" />
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/textView1"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Ticket No:"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#D3D9FF" />

                        <TextView
                            android:id="@+id/ticketNo"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text=""
                            android:textColor="#D3D9FF" />
                    </LinearLayout>
                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/textView12"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Report Date:"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#D3D9FF" />

                        <TextView
                            android:id="@+id/ticketReportDate"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text=""
                            android:textColor="#D3D9FF" />
                    </LinearLayout>


                        <TextView
                            android:id="@+id/textView13"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Details:"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#D3D9FF" />

                        <TextView
                            android:id="@+id/ticketDetails"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text=""
                            android:textColor="#D3D9FF" />

                </LinearLayout>
</ScrollView>
                <LinearLayout
                    android:id="@+id/llBtn"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:layout_marginBottom="10dp"
                    android:layout_marginTop="170dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:background="@drawable/blueborder"
                    android:orientation="horizontal"
                    android:padding="10dp" >

                    <Button
                        android:id="@+id/btnTicketDirections"
                        android:layout_width="match_parent"
                        android:layout_height="30dp"
                        android:layout_weight="1"
                        android:background="@drawable/directions" />

                    <Button
                        android:id="@+id/btnSolve"
                        android:layout_width="match_parent"
                        android:layout_height="30dp"
                        android:layout_weight="1"
                        android:background="@drawable/solve" />

                    <Button
                        android:id="@+id/btnOther"
                        android:layout_width="match_parent"
                        android:layout_height="30dp"
                        android:layout_weight="1"
                        android:background="@drawable/other" />


                </LinearLayout>
            </LinearLayout>
 <LinearLayout
     android:id="@+id/llListView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="40dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:layout_weight="2"
                android:background="@drawable/pepsiborder"
                android:orientation="vertical" >
     <TextView
        android:id="@+id/textView124"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#D3D9FF"
        android:text="Free Employees"
        android:textSize="30sp"
        android:gravity="left"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:textAppearance="?android:attr/textAppearanceLarge" />

     <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_marginLeft="20dp"

            >

    <ListView
        android:id="@+id/listTic"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginRight="5dp"
        android:layout_marginTop="20dp"
        android:divider="@android:color/transparent"
        android:dividerHeight="10dp" >

    </ListView>
  </LinearLayout>

 </LinearLayout>
 <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:layout_weight="2"
                android:id="@+id/noempLayout"
                android:background="@android:color/transparent"
                android:orientation="vertical" >
     <TextView 
         android:text="Please select free Employee to handle this problem!"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:gravity="center"
         android:layout_marginTop="300dp"
         />
 </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="40dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:layout_weight="2"
                android:id="@+id/empLayout"
                android:background="@drawable/pepsiborder"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/blueborder"
                    android:orientation="horizontal"
                    android:padding="10dp" >

                    <ImageView
                        android:id="@+id/empIcon"
                        android:layout_width="60dp"
                        android:layout_height="60dp"
                        android:layout_gravity="center_vertical"
                        android:layout_weight="0.1" />

                    <LinearLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_weight="0.7"
                        android:gravity="center_vertical"
                        android:orientation="vertical" >

                        <TextView
                            android:id="@+id/empName"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="7dp"
                            android:gravity="center_vertical"
                            android:textColor="#D3D9FF"
                            android:textSize="17sp" />
                    </LinearLayout>
                </LinearLayout>

                <fragment
                    android:id="@+id/empMap"
                    android:name="com.google.android.gms.maps.MapFragment"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="10dp" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:orientation="vertical" >

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/textView33"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Current Address:"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#D3D9FF" />

                        <TextView
                            android:id="@+id/empAddress"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text=""
                            android:textColor="#D3D9FF" />
                    </LinearLayout>



                <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/textView22"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Details:"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#D3D9FF" />

                        <TextView
                            android:id="@+id/empDetails"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text=""
                            android:textColor="#D3D9FF" />
                    </LinearLayout>
                    </LinearLayout>
                    <LinearLayout
                    android:id="@+id/llBtn2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:layout_marginTop="220dp"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:background="@drawable/blueborder"
                    android:orientation="horizontal"
                    android:padding="10dp" >

                    <Button
                        android:id="@+id/btnEmpDirections"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_weight="1"
                        android:layout_gravity="center"
                        android:background="@drawable/directions" />

                    <Button
                        android:id="@+id/btnEmpChat"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_weight="1"
                        android:layout_gravity="center"
                        android:background="@drawable/chat" />

                    <Button
                        android:id="@+id/btnEmpAssign"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_weight="1"
                        android:layout_gravity="center"
                        android:background="@drawable/assign" />


                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

ListView 项目布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="280dp"
    android:layout_height="90dp"
    android:orientation="horizontal"
    android:background="@drawable/border"
    android:layout_marginTop="10dp"
    android:padding="10dp"
     >

    <ImageView
        android:id="@+id/imgIcon"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_weight="0.1"
        android:gravity="center_vertical" 

         />
    <LinearLayout 
      android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:layout_weight="0.7"
    android:gravity="center_vertical"

        >
    <TextView
        android:id="@+id/txtTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:textSize="17sp"
        android:textColor="#D3D9FF"
        android:layout_gravity="center_vertical"
        android:layout_marginLeft="7dp"
           />
     <TextView
        android:id="@+id/txtTitle1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:layout_gravity="center_vertical"
        android:textSize="13sp"
        android:textColor="#D3D9FF"
        android:layout_marginLeft="7dp"
           />
      </LinearLayout>
</LinearLayout>

边框.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle"
       >
   <stroke
        android:width="2dip"
        android:color="#8D8D8D" />
   <corners android:radius="10dip"/>
   <solid android:color="#464A4F" />
</shape>

非常感谢任何帮助。

最佳答案

如果你想让 View 闪烁:

public void blink(final View v) {
        v.setBackgroundColor(Color.DKGRAY);
        v.animate().setDuration(25).alpha(0).withEndAction(new Runnable() {
            @Override
            public void run() {
                v.setBackgroundResource(R.drawable.standard_key_normal);
                v.setAlpha(1);
            }
        });
    }

将您的 View 发送到此函数,用您想要的任何可绘制对象或颜色资源替换背景。如果你想要多次眨眼,把它放在一个 for 循环中。

关于android - 将闪烁添加到自定义 ListView 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29799894/

有关android - 将闪烁添加到自定义 ListView 项目?的更多相关文章

  1. ruby - Facter::Util::Uptime:Module 的未定义方法 get_uptime (NoMethodError) - 2

    我正在尝试设置一个puppet节点,但ruby​​gems似乎不正常。如果我通过它自己的二进制文件(/usr/lib/ruby/gems/1.8/gems/facter-1.5.8/bin/facter)在cli上运行facter,它工作正常,但如果我通过由ruby​​gems(/usr/bin/facter)安装的二进制文件,它抛出:/usr/lib/ruby/1.8/facter/uptime.rb:11:undefinedmethod`get_uptime'forFacter::Util::Uptime:Module(NoMethodError)from/usr/lib/ruby

  2. ruby - 我需要将 Bundler 本身添加到 Gemfile 中吗? - 2

    当我使用Bundler时,是否需要在我的Gemfile中将其列为依赖项?毕竟,我的代码中有些地方需要它。例如,当我进行Bundler设置时:require"bundler/setup" 最佳答案 没有。您可以尝试,但首先您必须用鞋带将自己抬离地面。 关于ruby-我需要将Bundler本身添加到Gemfile中吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4758609/

  3. ruby - 如何在 buildr 项目中使用 Ruby 代码? - 2

    如何在buildr项目中使用Ruby?我在很多不同的项目中使用过Ruby、JRuby、Java和Clojure。我目前正在使用我的标准Ruby开发一个模拟应用程序,我想尝试使用Clojure后端(我确实喜欢功能代码)以及JRubygui和测试套件。我还可以看到在未来的不同项目中使用Scala作为后端。我想我要为我的项目尝试一下buildr(http://buildr.apache.org/),但我注意到buildr似乎没有设置为在项目中使用JRuby代码本身!这看起来有点傻,因为该工具旨在统一通用的JVM语言并且是在ruby中构建的。除了将输出的jar包含在一个独特的、仅限ruby​​

  4. ruby - 将 Bootstrap Less 添加到 Sinatra - 2

    我有一个ModularSinatra应用程序,我正在尝试将Bootstrap添加到应用程序中。get'/bootstrap/application.css'doless:"bootstrap/bootstrap"end我在views/bootstrap中有所有less文件,包括bootstrap.less。我收到这个错误:Less::ParseErrorat/bootstrap/application.css'reset.less'wasn'tfound.Bootstrap.less的第一行是://CSSReset@import"reset.less";我尝试了所有不同的路径格式,但它

  5. ruby-on-rails - Rails 3.2.1 中 ActionMailer 中的未定义方法 'default_content_type=' - 2

    我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer

  6. ruby-on-rails - form_for 中不在模型中的自定义字段 - 2

    我想向我的Controller传递一个参数,它是一个简单的复选框,但我不知道如何在模型的form_for中引入它,这是我的观点:{:id=>'go_finance'}do|f|%>Transferirde:para:Entrada:"input",:placeholder=>"Quantofoiganho?"%>Saída:"output",:placeholder=>"Quantofoigasto?"%>Nota:我想做一个额外的复选框,但我该怎么做,模型中没有一个对象,而是一个要检查的对象,以便在Controller中创建一个ifelse,如果没有检查,请帮助我,非常感谢,谢谢

  7. ruby - 主要 :Object when running build from sublime 的未定义方法 `require_relative' - 2

    我已经从我的命令行中获得了一切,所以我可以运行rubymyfile并且它可以正常工作。但是当我尝试从sublime中运行它时,我得到了undefinedmethod`require_relative'formain:Object有人知道我的sublime设置中缺少什么吗?我正在使用OSX并安装了rvm。 最佳答案 或者,您可以只使用“require”,它应该可以正常工作。我认为“require_relative”仅适用于ruby​​1.9+ 关于ruby-主要:Objectwhenrun

  8. ruby - 续集在添加关联时访问many_to_many连接表 - 2

    我正在使用Sequel构建一个愿望list系统。我有一个wishlists和itemstable和一个items_wishlists连接表(该名称是续集选择的名称)。items_wishlists表还有一个用于facebookid的额外列(因此我可以存储opengraph操作),这是一个NOTNULL列。我还有Wishlist和Item具有续集many_to_many关联的模型已建立。Wishlist类也有:selectmany_to_many关联的选项设置为select:[:items.*,:items_wishlists__facebook_action_id].有没有一种方法可以

  9. ruby-on-rails - 项目升级后 Pow 不会更改 ruby​​ 版本 - 2

    我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby​​版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby​​版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘

  10. ruby-on-rails - 新 Rails 项目 : 'bundle install' can't install rails in gemfile - 2

    我已经像这样安装了一个新的Rails项目:$railsnewsite它执行并到达:bundleinstall但是当它似乎尝试安装依赖项时我得到了这个错误Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcheckingforlibkern/OSAtomic.h...yescreatingMakefilemake"DESTDIR="cleanmake"DESTDIR="

随机推荐