我有一个实现的类expandable list activity.
在XML代码中(或者我可以在java中完成),我设置fastScrollEnabled为true.这样做可以实现快速滚动.但快速滚动仅适用于列表的顶部.就像我可以使用fastscroll拇指栏滚动整个列表,但只能在滚动条的顶部工作.它与整个列表不成比例.我可以将拇指栏拖动到列表的底部,但它不会滚动,因为listview它已经滚动到底部,因为它的奇怪行为只能在列表的顶部工作.
令我感到困惑,如果需要,我可以尝试澄清更多......
我确实实现了一个自定义 BaseExpandableListAdapter.
我有一个Textview我正在显示文本12345现在我想显示文本
1
2
3
4
5
Run Code Online (Sandbox Code Playgroud)
我尝试了rotation但是它会旋转我的文字并且没有给出确切的外观.
我不想放置\n标签character.
我不想定制.
我有一个用于PreferenceActivity的xml文件(/res/xml/setting.xml):
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Main Settings">
<ListPreference
android:title="Background Image"
android:summary="Set the background image"
android:key="key_background"
android:entries="@array/background"
android:entryValues="@array/background_values"
android:defaultValue="winter.png" />
</PreferenceCategory>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
然后我有另一个xml文件"/res/values/string.xml":
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="background">
<item>Winter</item>
<item>Desert</item>
</string-array>
<string-array name="background_values">
<item>winter.png</item>
<item>desert.png</item>
</string-array>
</resources>
Run Code Online (Sandbox Code Playgroud)
请参阅setting.xml中的ListPreference,我想android:defaultValue设置为winter.png.但是我也不想在xml中设置硬编码/常量值,所以我尝试了各种值,如" @array/background_values/0"," @array/background_values[0]"等...但都失败了.
所以,问题是:
android:defaultValue是否正常工作?@array语法的文档?我找不到任何东西.我想创建一个包含3个列表和3个标题的页面,但我不想单独滚动它们,我希望整个页面滚动.有谁知道我怎么能做到这一点?
基本上我希望它看起来像这样:
header
smlheader
list
smlheader
list
smlheader
list
Run Code Online (Sandbox Code Playgroud)
有了这段代码,我试图实现它,但它不是那么好.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white">
<include layout="@layout/header" />
<include layout="@layout/redcell" />
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="60dp" >
<TextView
android:id="@+id/fixtures_text"
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center"
android:text="@string/leagues"
android:textColor="@color/white"
android:textSize="25dp"
android:textStyle="bold"/>
</TableRow>
<include layout="@layout/redcell" />
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="60dp" >
<TextView
android:id="@+id/results_text"
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center"
android:text="@string/leagues"
android:textColor="@color/white"
android:textSize="25dp"
android:textStyle="bold"/>
</TableRow>
<include layout="@layout/redcell" />
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</TableLayout>
<ScrollView/>
Run Code Online (Sandbox Code Playgroud) 在onCreate()我的主要活动的方法中,我调用我的dbManager的构造函数,我调用open函数创建一个a的实例,SQLiteOpenHelper而不是我调用getWritableDatabase()它.在UIThread中,我将记录添加到数据库并将这些记录保存到ArrayList.另外两个线程检查ArrayList做什么,然后更新列表和数据库.现在我想在UI中添加一个按钮来删除数据库和列表记录AsyncTask.我已经读过该SqliteOpenHelper对象保存在一个数据库连接上.因此,如果有一个帮助程序实例,则只有一个数据库连接.此连接可以在多个线程中使用,SqliteDatabase对象使用java锁来保持访问序列化.那么如果我在数据库上写了多个线程,那么一个线程会等到前一个线程完成其操作?
添加新功能(全部删除)可能会产生问题,因为我必须避免两个线程中的一个尝试编辑不再存在的记录.我怎样才能实现目标?谢谢.
当布尔标志设置为true时,我的应用程序请求在后台服务中进行更新.如果flag设置为true,那么我获取一个PARTIAL_WAKE_LOCK让我的后台服务运行.我的问题是:
因为我从位置管理器请求更新(我不手动请求更新但订阅locationManager.requestLocationUpdates)...即使设备进入睡眠状态,locationManager是否仍然正常/正常工作PARTIAL_WAKE_LOCK?
我读过有一个WifiLock -> WIFI_MODE_SCAN_ONLY我没有收购的.由于位置管理器使用wifi扫描通过wifi热点检测位置,我也应该获得这个吗?
设备进入睡眠状态时gps位置更新怎么样?
我目前正在Samsung Galaxy S2 i1900G尝试测试我的应用程序,但显然我需要推送一个数据库文件,以便我的应用程序连接到它并工作.但似乎每次我尝试将文件推入设备时都会出错.
这是我不断得到的错误
[2012-05-20 16:16:26 - ddms] transfer error: Read-only file system
[2012-05-20 16:16:56] Failed to push selection: Read-only file system
Run Code Online (Sandbox Code Playgroud)
我似乎无法弄清问题是什么.如果我要根我的手机,它会有什么不同吗?现在可以根据三星Galaxy S2 i1900G型号吗?希望你们能帮助我.
我已经打包我的jar文件内的exe文件,我试图将其复制到一个临时位置,这样我可以使用运行它Desktop.browse(),要做到这一点,我设置了输入流构造扫描仪使用class.getResourceAsStream,然后用printwriter写的,所有的到一个文件.发生的问题表明exe无效.我认为这是由于一些二进制数据丢失.如果有人可以提供帮助,请发表评论.
Scanner sc = new Scanner(ClassBuilder.class.getResourceAsStream("jd-gui.exe"));
File copy = new File("C://users//Owner//Desktop//java//jd-gui.exe");
copy.createNewFile();
PrintWriter writer = new PrintWriter(copy);
while(sc.hasNextLine())
writer.println(sc.nextLine());
writer.flush();
writer.close();
sc.close();
Desktop.getDesktop().browse(copy.toURI());
Run Code Online (Sandbox Code Playgroud) 我开发了一个Android应用程序但是当我尝试通过Eclipse在模拟器中运行它时,模拟器总是需要很长时间才能加载.我已经决定在VirtualBox上创建一个Android虚拟机,我已安装AndroBOX-2.3.r.1-generic,它运行良好,速度更快,但是当我尝试运行我的应用程序时,我有一个RuntimeException: unable to start activity ComponentInfo: android.view.InflateException: Binary XML file line #2: Error inflating class GridLayout.
我希望如果我使用自定义分辨率运行Android虚拟机,问题就可以解决了.我开发了一个10.1英寸WXGA800平板电脑(Theme.Holo)的应用程序.如何找到有用的分辨率数据来编辑.vbox配置文件?
<ExtraData>
<ExtraDataItem name="GUI/LastCloseAction" value="?"/>
<ExtraDataItem name="GUI/LastGuestSizeHint" value="?,?"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition" value="?,?,?,?"/>
<ExtraDataItem name="CustomVideoMode1" value="?x?x?"/>
Run Code Online (Sandbox Code Playgroud)
</ExtraData>
非常感谢.
GridView适配器ImageView从布局创建.所有图像都是从URLs数据库item IDs中下载的,其中ID来自a JSONArray.让我们说,视图现在显示的项目
ID: 1,3,4,7.由于GridView项是动态的,因此位置(从0开始)无法在GridView上真正识别我的项目.有没有其他方法可以从数据库项ID中识别该图像?
public OnItemClickListener ClickListner = new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//Toast.makeText(getApplicationContext(),
// ""+position, Toast.LENGTH_SHORT).show();
//Identification code for the item to be added here
Intent view =
new Intent(main.this, View.class);
view.putExtra("ID", id);
//expected to have an ID equal to database item ID
startActivity(view);
}
};
Run Code Online (Sandbox Code Playgroud) 在MainActivity中,每隔x秒我创建一个新的AsyncTask,并调用execute with new RTask(this).execute(param);以异步方式将数据发送到服务器.我认为创建一个新任务经常会导致内存泄漏.因此,当垃圾收集器释放内存时,如何将任务引用设置为null以允许收集它?我试过在this.cancel(true);内部使用,onPostExecute()但我已经读过,由于Android框架的一个错误,onpost从未被调用过.任何建议将不胜感激.
谢谢