我编写了一个自己的Adapter并通过ListView将它添加到我的ListActivity中.我编写自己的适配器的原因是,我必须对list-entrys进行一些布局更改.在列表的每个条目中,我有3个TextView.
<?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="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<TextView
android:id="@+id/myNr"
android:layout_width="40dip"
android:layout_height="fill_parent"
android:layout_marginRight="15dip"
android:text="id"
android:textSize="25dip"
android:background="#333333"
android:gravity="center_horizontal"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent">
<TextView
android:id="@+id/editor"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Editor: " />
<TextView
android:id="@+id/date"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"
android:text="Date: " />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我做的下一件事是实现"onListItemClick-Methode".之后我使用以下代码实现了一个onListItemLongClick - Listener:
在onCreate of the Activity中我添加了:
registerForContextMenu(getListView());
Run Code Online (Sandbox Code Playgroud)
然后我添加了以下方法:
Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo){
AdapterView.AdapterContextMenuInfo info;
info = (AdapterView.AdapterContextMenuInfo) menuInfo;
long id = getListAdapter().getItemId(info.position);
}
Run Code Online (Sandbox Code Playgroud)
其中"id"是列表中项目的索引.我现在想要获得texview的文本,其id ="myNr of this ListItem.有没有办法得到这个文本?
我实际上有一个Windows/Java问题.我有一个插件设备,我想通过Java访问.通常你可以通过驱动器号访问一个例如USB-Stick ...但是这个平板电脑被Windows显示为"便携式设备"...这意味着,路径就像"Computer\Archos 5S"这样的东西没有驱动器号.
我想通过Java访问此设备上的文件,但我无法弄清楚它的正确路径.有一个类似的问题,但没有一个有效的答案.或者是否有另一种通过Java访问此设备的方法?
其实我还没有解决这个问题......我仍然无法通过java访问这样的设备.
目前我正在尝试使用Java访问Windows ShellFolder.一个Shellfolder如:"Shell ::: {35786D3C-B075-49b9-88DD-029876E11C01}"
这可能与Java有关吗?最近我发现了sun.awt类"ShellFolder"......这是想要的功能吗?
谢谢你的帮助Ripei
我想在Joomla中使用模板覆盖文章覆盖,因此我正在使用
mytemplate/html/com_content/article/default.php
Run Code Online (Sandbox Code Playgroud)
如果我在此文件中更改了任何内容,则会显示更改.但是因为我想使用额外的.php文件fe
mytemplate/html/com_content/article/alternativeLayout.php
Run Code Online (Sandbox Code Playgroud)
我正面临一个问题.因为虽然我可以在文章设置页面上选择此布局 - 但我所做的任何更改都不会出现,但仍然使用default.php.
我有什么想法我做错了吗?