使用Flex Builder 3:
过去几个小时,我在每次调试启动时都遇到了这个问题.
我以前也经常这样做,但偶尔也不会每次启动调试.
我发现flex调试器使用了某个7935端口,但我无法弄清楚
如何更改它?
我有两个具有相同功能的指令,如下所示.
angular.module('ui.directives', [])
.directive('uiFoo',
function() {
return {
restrict: 'EAC',
link: function($scope, element, attrs) {
//to do functionality
element.append("test content");
}
};
})
.directive('uiFoo1',
function() {
return {
restrict: 'EAC',
link: function($scope, element, attrs) {
//to do functionality
element.append("test content");
}
};
});
Run Code Online (Sandbox Code Playgroud)
它们都包含相同的工作方式,它将"测试内容"作为文本附加到该元素.是否有可能改为制定这两个指令.我可以为一个指令写两个名称/我可以使用优化代码使用相同的功能.在这里,我正在编写相同的代码,没有任何意义.而不是写指令两次,有没有任何优化方式.我是AngularJS的新人,请帮助我.提前致谢!
其实我正在开发一个有多个listviews的android应用程序.在ListView的实现中,我为每个列表视图项膨胀一个单元格.这是category_cell.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="60dip"
android:id="@+id/cell_layout"
android:background="@drawable/list_bg">
<RelativeLayout
android:id="@+id/category_cell_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/category_image"
android:layout_centerVertical="true"
android:layout_marginLeft="10dip"
android:layout_height="45dip"
android:layout_width="45dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/category_name"
android:text="Category Name"
android:textSize="16dip"
android:typeface="sans"
android:layout_centerVertical="true"
android:layout_marginLeft="70dip"
android:textColor="@color/white" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/arrow_image"
android:background="@drawable/list_arrow"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dip" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
在这个单元格的背景上,放置一个可绘制的xml.list_bg.xml有以下代码:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/transparent" />
<item
android:state_pressed="true"
android:drawable="@color/blue" />
<item
android:state_selected="true"
android:state_pressed="false"
android:drawable="@color/blue" />
</selector>
Run Code Online (Sandbox Code Playgroud)
在使用项目填充列表视图时,我想为每个项目的背景xml的按下和聚焦状态设置不同的颜色.每个项目都包含一个颜色的值,我想在该项目的按下状态下设置该颜色.
StateListDrawable states = new StateListDrawable();
states.addState(new int[] {android.R.attr.state_pressed},getResources().getDrawable(R.color.translucent_red));
states.addState(new int[] {android.R.attr.state_focused},getResources().getDrawable(R.color.white));
states.addState(new int[] { …
Run Code Online (Sandbox Code Playgroud)