我试图在GridView中显示一个动态增长的字符串列表,其中包含一个复选框,GridView本身位于TableLayout中.
我可以连续显示这些"已复选"的字符串.当我让用户在GridView中动态添加新字符串时,我的问题出现了.
我创建了一个接收字符串列表的自定义适配器.假设我们有n个字符串.适配器为项目计数返回'n + 1'; 在getView中,它返回:
到现在为止还挺好.单击"+"按钮时,我将一个空字符串添加到字符串列表中,并在适配器中调用notifyDataSetChanged.
GridView重新绘制了一个项目.但它保持原始高度并创建一个垂直滚动条.我希望GridView扩展它的高度(即在屏幕上占用更多空间并显示所有项目).
我试图将屏幕更改为垂直LinearLayout而不是TableLayout,但结果是相同的.
这是我的屏幕布局:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<!-- other lines omitted -->
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wine_rack_explanation"
android:layout_gravity="center_vertical" />
<GridView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/gvRack"
android:columnWidth="90dp"
android:numColumns="auto_fit" />
</LinearLayout>
<!-- other lines omitted -->
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
适配器中的复选框+字符串项定义如下:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cbCoordinate"
android:checked="true"
/>
<EditText android:id="@+id/txtCoordinate"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
"+"按钮项定义如下:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="@+id/btnAddBottle" …Run Code Online (Sandbox Code Playgroud) 我有扩展的自定义控件DataGrid.它被称为ExtendedDataGrid.我希望为它提供样式ExtendedDataGrid与DataGrids样式相同,除非它更改模板.我尝试过这样的事情:
<Style TargetType="{x:Type MyControls:ExtendedDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="Template">
...
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
但它说没有找到资源.
所以我尝试:
<Style TargetType="{x:Type MyControls:ExtendedDataGrid}" BasedOn="{StaticResource {ComponentResourceKey ResourceId=DataGridStyle, TypeInTargetAssembly={x:Type DataGrid}}}">
<Setter Property="Template">
...
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
但它也行不通......那我该怎么办?
即使在大屏幕上,SharePoint 2007(WSS或MOSS)日志也不容易阅读,任何人都可以遇到能够执行以下操作的日志查看器:
上述功能的一部分是可以接受的,WinForms或SharePoint功能等一系列工具也是可以接受的.
除了引起我注意的顺序之外,下面的列表没有任何特定的顺序.如果您对以下答案中的产品upvote/comment有任何经验,我已经发布了我找到的日志查看器.
发现到目前为止:
如何检查触发器中的空字符串
<Trigger Property="Source" SourceName="ControlName" Value="">
<Setter Property="Height" Value="0" TargetName="ControlName" />
</Trigger>
Run Code Online (Sandbox Code Playgroud)
如果imageControl的源是空字符串或未设置,我已将控件的高度设置为0?我怎么能这样做,基本上如果没有设置图像,那么我想隐藏模板中的图像控件.
提前致谢.
Windows 8商店应用不再支持线程:
我在类库中创建一个线程:
protected static Thread m_thread = null;
Run Code Online (Sandbox Code Playgroud)
然后在其中一个功能:
m_thread = new Thread(new ParameterizedThreadStart(RunDetection));
m_thread.Start(Something);
Run Code Online (Sandbox Code Playgroud)
我还需要中止该功能:
m_thread.Abort();
Run Code Online (Sandbox Code Playgroud)
如何在WIN8商店应用中执行此操作?
我正在攻读Spring Core认证,我对使用JdbcTemplate有一些疑问.
我知道JdbcTemplate为我提供了不同的方法来执行查询(用SQL编写).
所以我有以下方法:
1)queryForObject():
public long getPersonCount() {
String sql = “select count(*) from PERSON”;
return jdbcTemplate.queryForObject(sql, Long.class);
}
Run Code Online (Sandbox Code Playgroud)
所以在这个方法中我指定了2个参数,分别表示返回对象的SQL语句和类类型.在前一种情况下,指定将查询结果返回到Long对象.
如果从查询返回的结果与指定的类型不匹配,会发生什么?(例如,如果查询返回一个String并且我已经指定了一个Long作为queryForObject()方法的参数?这样的情况如何处理?
2)queryForMap():
public Map getPersonInfo(int id) {
String sql = “select * from PERSON where id=?”;
return jdbcTemplate.queryForMap(sql, id);
}
Run Code Online (Sandbox Code Playgroud)
阅读文档在我看来,只有当我的查询返回单行时才使用它.这是对的吗?
所以现在我怀疑与queryForMap()方法的使用有关.
我知道Map接口使用存储对象 系统.
因此,Map被认为存储多个夫妇.所以我认为这可以存储多行:Map的键是我表的一行的键,值包含其他列的值(到一个对象).
但似乎queryForMap()方法的逻辑是完全不同的.它是如何工作的?
也许它会返回一个以这种方式工作的Map:
key:包含表的主键的键,并且与此键相关联的多个值与我表的其他字段的内容相关.或者是什么?
3)queryForList():
public List getAllPersonInfo() {
String sql …Run Code Online (Sandbox Code Playgroud) 是否可以一次在Visual Studio .NET IDE中加载多个解决方案,以便两个解决方案都出现在解决方案资源管理器中?
谢谢
我想从这篇文章中了解石英春: http://examples.javacodegeeks.com/enterprise-java/spring/beans-spring/spring-3-scheduler-example-jdk-timer-and-quartz-showcase /
当我在STS中导入此示例时出现错误:
导入org.springframework.scheduling.quartz无法解析
在这一行:
import org.springframework.scheduling.quartz.QuartzJobBean;
c# ×2
java ×2
spring ×2
wpf ×2
android ×1
datagrid ×1
gridview ×1
jdbctemplate ×1
logging ×1
sharepoint ×1
spring-jdbc ×1
styles ×1