我在ListView中得到了一个奇怪的行为,只有一个ListView,我的应用程序中有很多ListView,但只是在这种情况下才会发生.
我会尝试解释,当我滚动到底部时,好吧,卷轴最后会停止.当我滚动到顶部时,它就像顶部的滚动条并回到底部.
我有这个视频显示问题.
这是我的ListView的xml:
<ListView
android:id="@+id/lv_resultado_produtos"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@color/Black"
android:dividerHeight="1dip"
android:fastScrollEnabled="true"
android:scrollX="0dip"
android:scrollY="0dip"
android:scrollbarSize="22dip"
android:scrollbarStyle="outsideOverlay" />
Run Code Online (Sandbox Code Playgroud)
并且以编程方式我只使用我的CustomAdapter设置适配器,仅此而已.
我测试了其他ListViews,我没有得到这种行为.
如果有人帮助我,我会很高兴的.
[编辑]
这是我的适配器,它有点复杂,对不起,我试过保留一切,但在字符大小方面有一些限制:
[PACKAGE]
[IMPORTS]
public class CustomAdapter_Produto_Insercao extends ArrayAdapter<Produto_Insercao> {
static View view_aux = null;
static OnClickListener listener_convertView = null;
static OnClickListener listener_btn_editar_produto = null;
static Activity ctx;
static Dialog_TW ad_estoque;
static List<Condicao_Preco> list_tabela_preco_condicao;
public static boolean clickable = true;
public static boolean highlight = false;
public static int linha_atual = 0;
public static View view_atual = null;
static …Run Code Online (Sandbox Code Playgroud) 好吧,我正在尝试在更改数据后获取listview高度,但它总是返回先前的高度,而不是实际高度.
所以当我设置setadapter时,它会获得旧值.例如:
ActualHeight = 100
Change data (filter) -> NewHeight = 60
ListView.GetHeight still returns 100.
Again
ActualHeight = 60
Change data (filter) -> NewHeight = 20
ListView.GetHeight still returns 60.
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是:
int width, height = 0;
EditText edt_search;
ListView lv_marca;
List<Marca> list_marca = new ArrayList<Marca>();
List<Marca> list_marca_search = new ArrayList<Marca>();
String text = edt_search.getText().toString();
list_marca_search.clear();
if(text.startsWith(".")){
text = text.replace(".", "");
for (Marca m : list_marca) {
if (String.valueOf(m.getCd_marca()).equals(text)){
list_marca_search.add(m);
}
}
} else {
for (Marca m : lista_marca) …Run Code Online (Sandbox Code Playgroud) 我在Primefaces组件graphicImage中显示图像时遇到问题.
当我的MB是SessionScoped时,一切正常.但是当它ViewScoped时,图像没有显示出来.
我可以保持SessionScoped,但我的页面上传/删除图像,并存储在PostgreSQL中(请,我的软件架构强迫我这样做).问题是当我插入新图像或删除一个图像时,页面仍显示最后的值(未刷新的图像),直到我关闭浏览器并再次打开.我希望通过ViewScoped我可以重新加载页面,我的问题就解决了.
这是页面的快照:
<p:panel id="panelListFotoProduto" header="Fotos do Produto" toggleable="true" collapsed="false" closable="false"
toggleSpeed="500" widgetVar="panelListFotoProduto" visible="true" >
<p:dataTable id="listFotoProduto" paginatorPosition="bottom" value="#{produtoMB.listProdutoFoto}"
lazy="true" var="pf" selectionMode="single" paginator="true" rows="1"
rowKey="#{pf.id}">
<p:column style="width: 100%" >
<h:panelGrid columns="1" cellpadding="4">
<p:graphicImage id="imageProduto" value="#{produtoMB.getFoto(pf)}" onclick="dialogFotoProduto.show()"/>
<p:commandButton value="Excluir" style="width: 100%;" update=":growl :formProduto:panelListFotoProduto" actionListener="#{produtoMB.removeFoto(pf)}"/>
</h:panelGrid>
</p:column>
<f:facet name="footer">
<h:panelGrid columns="1" cellpadding="4">
<p:commandButton value="Adicionar" style="width: 100%;" update=":growl :formProduto:panelListFotoProduto" actionListener="#{produtoMB.adicionarFoto()}"/>
<h:outputText id="totalProdutos" style="font-weight:bold" value="Total de Fotos Cadastrados: #{produtoMB.listProdutoFoto.size() }"/>
</h:panelGrid>
</f:facet>
</p:dataTable>
</p:panel>
Run Code Online (Sandbox Code Playgroud)
这是我的MB:
@ManagedBean
@SessionScoped
public class ProdutoMB {
private Produto …Run Code Online (Sandbox Code Playgroud)