我使用带有自定义适配器的ListView将项目显示为标题/副标题TextViews对.
不幸的是,我可以通过点击它的上半部分来选择一个项目,即标题占用的项目
这是我正在使用的代码:
journal_list.xml
<?xml version="1.0" encoding="utf-8"?>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawSelectorOnTop="false"
android:background="#fff"
android:cacheColorHint="#fff"
android:paddingBottom="6dp"
/>
Run Code Online (Sandbox Code Playgroud)
journal_list_item.xml用于列表项的布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
>
<TextView
android:id="@+id/journal_entry_date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000"
android:textSize="18sp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
/>
<TextView
android:id="@+id/journal_content"
android:paddingLeft="28dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="16sp"
android:textColor="#555"
android:inputType="textMultiLine"
android:maxLines="2"
android:minLines="1"
android:layout_below="@id/journal_entry_date"
android:layout_alignParentLeft="true"
/>
Run Code Online (Sandbox Code Playgroud)
适配器的代码:
private class JournalAdapter extends ArrayAdapter<JournalEntry> {
Context ctxt;
public JournalAdapter(Context ctxt) {
super(ctxt, R.layout.journal_list_item);
this.ctxt = ctxt;
}
public View getView(int position, View convertView, ViewGroup parent) {
View row …Run Code Online (Sandbox Code Playgroud) 我有一个相对较大的XML布局(38 kB,600行),其层次结构如下:
<ScrollView>
<LinearLayout>
<TabHost>
<LinearLayout>
<FrameLayout> //tab widget
<LinearLayout> //tab content
<LinearLayout> //section
<TextView> //section name
<LinearLayout orientation="horizontal"> //item 1 box
<TextView> //item 1 title
<Spinner> //item 1 picker
</LinearLayout>
<LinearLayout> //item 2 box
<TextView> //item 2 title
<Spinner> //item 2 picker
</LinearLayout>
... //18 other items
</LinearLayout>
... //4 other sections with 15 items each
</>
Run Code Online (Sandbox Code Playgroud)
它是一个数据输入表单,必须包含许多项目,我现在可以做的最好的事情是setContentView使用"正在加载..."对话框将数据包装和加载到AsyncTask中的微调器.
广泛使用主题是否会减缓观点通胀?视图inflater不需要查看加载的theme.xml,但是如果我将主题内联到布局xml中,它也会大大增加XML的大小,从而减慢解析器的速度.
我可以做些什么来简化布局,使其加载速度至少快两倍?我想我可能会试图摆脱水平的LinearLayouts,并使用TableLayout构建"部分".
无法删除Magento EE 1.10.1.1版本中的js/jqzoom/jquery-1.3.1.min.js脚本.此脚本正在app/design/frontend/enterprise/default/layout/catalog.xml中添加(在第196行附近).
这是我的local.xml布局文件中的代码:
<catalog_product_view>
<action method="removeItem"><type>skin_js</type><name>js/jqzoom/jquery-1.3.1.min.js</name></action>
</catalog_product_view>
Run Code Online (Sandbox Code Playgroud)
如何在不修改核心布局文件的情况下删除此脚本?谢谢.
我想创建指令,所以当用户按下下一个按钮时我想设置为下一个布局页面.我试过,setContentView(R.layout.aboutus);但它似乎将新布局设置为特定页面.
布局:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#dddddd">
<LinearLayout android:gravity="center" android:background = "@drawable/aboutus"
android:orientation="vertical" android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
代码:
public void onItemClick(AdapterView<?> parent, View view, int position,
long lg) {
switch (position) {
case 4:
setContentView(R.layout.aboutus);
}
}
Run Code Online (Sandbox Code Playgroud)
所以,我想知道如何在没有新活动的情况下进入下一个布局,并且可以返回上一页.谢谢.
我有一个问题.我有一个ListActivity,我无法通过R访问,我自己为它编写的布局,我做错了什么.
所以这是布局代码(list_layout.xml):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nofilter"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
现在我无法将该布局绑定到我的ListActivity上setContentView(R.layout.list_layout);
这里有一些关于ListActivity的代码:
package de.retowaelchli.filterit.stats;
import java.util.ArrayList;
import java.util.List;
import de.retowaelchli.filterit.database.ADFilterDBAdapter;
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;
public class CreatedADFilters extends ListActivity {
//Variablen deklaration
private ADFilterDBAdapter mDbHelper;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.list_layout);
}
}
Run Code Online (Sandbox Code Playgroud)
我做错了吗?
最好的祝福
苹果浏览器
笔记:
我试图清理我的项目,它没有工作.
为什么当我发布JDialog它时,它会以萎缩的方式弹出!我必须调整它的大小才能看到它的内容,并且标签之类的一些内容根本不显示!我有什么设置吗?
我不知道你是否在Andrew的解决方案下看到了我的评论.我只是想说pack()方法解决了jDialog以缩小的方式显示的问题,但是,我仍然有这个问题,我在jDialog中的一些控制器要么根本不显示,要么显示在随机调整大小办法.如果您也可以为这种情况提供补救措施,我将非常感谢!
jDialog_DSCredentials = new javax.swing.JDialog();
jDialog_DSCredentials.setTitle(resourceMap.getString("jDialog_DSCredentials.title")); // NOI18N
jDialog_DSCredentials.setLocationByPlatform(true);
jDialog_DSCredentials.setName("jDialog_DSCredentials"); // NOI18N
jDialog_DSCredentials.getContentPane().setLayout(new java.awt.CardLayout());
// Code of sub-components and layout - not shown here (I can send these if nec.)
Run Code Online (Sandbox Code Playgroud)
以下是从事件方法调用它的方式
jDialog_DSCredentials.pack();
jDialog_DSCredentials.revalidate();
jDialog_DSCredentials.setVisible(true);
Run Code Online (Sandbox Code Playgroud) 我使用'皮肤'方法将css加载到我的Zend Framework站点.
来自layout.phtml:
<head>
<?php
print $this->headTitle();
print $this->headScript();
$this->loadSkin($this->skin);
print $this->headLink();
print $this->jQuery();
print $this->layout()->customJS;
?>
</head>
Run Code Online (Sandbox Code Playgroud)
其中loadSkin()是一个如下所示的视图助手:
class Zend_View_Helper_LoadSkin extends Zend_View_Helper_Abstract {
public function loadSkin ($skin) {
$skinData = new Zend_Config_Xml('./skins/' . $skin . '/skin.xml');
$stylesheets = $skinData->stylesheets->stylesheet->toArray();
if (is_array($stylesheets)) {
foreach ($stylesheets as $stylesheet) {
$this->view->headLink()->appendStylesheet('$skin.'/css/'.$stylesheet);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
一切都在浏览器(任何图形浏览器)中显示,包括jQueryUI元素,如:http://i.stack.imgur.com/70PVl.png .
但是当我打印时,css完全被忽略了,就像这里:http: //i.stack.imgur.com/NGC25.png.
我完全难过了 - 在这里或ZF论坛上找不到任何关于为打印提供单独的css参数的内容.任何指针将不胜感激!
在此先感谢,罗曼
我该如何转换它:

占据整个区域,当最大化时,作为记事本:

我是怎么做到的 我希望这很清楚.提前致谢.
我试图将这些按钮放在中心,但大多数在线的东西都不起作用.<center>不起作用,text-align:center不起作用.
按钮应以完全相同的方式显示,除了居中于中间.如果您尝试这样做,它将无法正常工作.我猜,一定有问题.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>website</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
});
</script>
<style type="text/css">
.button0 {
position:fixed;
left:88px;
top:58px;
font-family:MS Shell Dlg 2;
font-size:8px;
font-weight:NORMAL;
}
.button1 {
position:fixed;
left:6px;
top:191px;
font-family:MS Shell Dlg 2;
font-size:8px;
font-weight:NORMAL;
text-align: center;
margin-left:auto;
margin-right:auto;
}
.button2 {
position:fixed;
left:358px;
top:216px;
font-family:MS Shell Dlg 2;
font-size:8px;
font-weight:NORMAL;
}
</style>
<body>
<center>
<div class="button0"><input type="button" style="width: 268px;height: 145px;" value="Button"/></div>
<div class="button1"><input …Run Code Online (Sandbox Code Playgroud) 我是android的新手,并尝试使用Bitmap和BitmapFactory将SDcard图像放入网格视图中.但它会导致错误:
ERROR/AndroidRuntime(6137): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
ERROR/AndroidRuntime(6137): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
ERROR/AndroidRuntime(6137): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:459)
ERROR/AndroidRuntime(6137): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:271)
Run Code Online (Sandbox Code Playgroud)