奇怪的一个.(可能根本不奇怪)
我有3个对象,员工,罗塔和部门.
public class Employee
{
public int Id { get; set; }
public String Name { get; set; }
public virtual Department Department { get; set; }
}
internal class EmployeeMapping : EntityTypeConfiguration<Employee>
{
public EmployeeMapping()
{
HasKey(a => a.Id);
Property(a => a.Id).HasColumnName("UserId");
HasRequired<Department>(a => a.Department).WithOptional().Map(a => a.MapKey("DepartmentId"));
}
}
public class Department
{
public int Id { get; set; }
public String Name { get; set; }
}
internal class DepartmentMapping : EntityTypeConfiguration<Department>
{
public DepartmentMapping()
{
HasKey(a …Run Code Online (Sandbox Code Playgroud) 我希望这个标题足够清楚.
我有2个项目,MyProject.Website(ASP.NET MVC3前端)和MyProject.WcfService.当我托管网站时,我宁愿不必在IIS内部托管两个网站,我希望能够只托管MyProject.Website并在其中引用MyProject.WcfService.
我知道我可以通过ServiceHost来做到这一点,这应该有用,但有更好的方法吗?
有一个奇怪的.我已经把它归结为一个非常简单的例子.真的想不出来.
我在LinearLayout中有一个LinearLayout.我想使用动画来调整孩子的大小(有时我会做一些治疗).这是我的布局XML.
<?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" >
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
<!-- Lots more controls will appear above -->
<LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:id="@+id/animation_subject">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:gravity="center" />
</LinearLayout>
<!-- Lots more controls will appear below -->
</LinearLayout>
<Button android:text="Slide it Down!" android:layout_width="fill_parent" android:layout_height="wrap_content" android:onClick="btnDoAnimDown_OnClick" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
现在,正如您所看到的,有一个按钮,这是该按钮的代码.
public void btnDoAnimDown_OnClick(View v)
{
View pnlSlider = findViewById(R.id.animation_subject);
pnlSlider.measure(1000, 1000);
DropDownAnim anim = new DropDownAnim(pnlSlider, pnlSlider.getMeasuredHeight(), true);
anim.setDuration(2000);
pnlSlider.startAnimation(anim);
return;
}
Run Code Online (Sandbox Code Playgroud)
如果你现在运行它,它不会下滑.完全没有.但是,如果您要将Button移动到我已命名为Overview的LinearLayout并将其放在Child LinearLayout之后,那么它就可以了!像这样...
<?xml version="1.0" encoding="utf-8"?> …Run Code Online (Sandbox Code Playgroud) 我感觉有点愚蠢,因为我找不到这个问题的答案,这让我觉得我实际上是在问错误的问题.但是,这里......
我有一个列表视图,以及在xml中定义的listviewitem,有几个字段,没什么特别的.全部设置为可见.
然后我使用自定义ArrayAdapter绑定到我的ListView,并希望在第5行隐藏我的一个文本视图.但是,它似乎隐藏了我在项目0和项目5上的TextView.这有点奇怪?我已经简化了代码,重现了问题,希望有人能够帮助我......
我的适配器
public class MenuScreenAdapter extends ArrayAdapter<String>
{
private List<String> _items;
private Context _context;
public MenuScreenAdapter(Context context, List<String> items)
{
super(context, R.layout.list_menu_item, items);
_context = context;
_items = items;
}
private MenuScreenAdapter(Context context, int textViewResourceId)
{
super(context, textViewResourceId);
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View v = convertView;
if (v == null)
{
LayoutInflater vi = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list_menu_item, null);
}
String o = _items.get(position);
if (o …Run Code Online (Sandbox Code Playgroud)