English 中文(简体)
表格 清单中不得点击的观点
原标题:Android TableView as itemview in ListView not clickable

我正在使用一个定制改编器,配备一份清单,并使用一个定制格式提供清单目表。 我的布局就是这样。

> LinearLayout
    > TableView
        > TableRow
            > TextView
            > TextView

这导致清单中未对点击做出回应的项目,但如果我把布局推到以下项目中去的话,则会这样做。

> LinearLayout
    > TextView
    > TextView

因此,我知道,我的适应者和活动没有任何错误。

我已尝试按照本问题的建议,将列入上层线布局。 名单 无法点击的眼光项目 口粮 内容提要

我还尝试在<条码>上添加<条码> 安德罗德:clickable="true>和android:focusable=“true” 至<条码>,但两者均未奏效。

任何想法?


EDIT

三. 第十条ML源代码

<?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="wrap_content">
    <TableLayout  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:stretchColumns="1"
    >
        <TableRow 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:clickable="true"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="center_vertical">
            <TextView 
                android:id="@+id/ITEMVIEW_TEXT2_lblText" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20sp" 
                android:paddingRight="5dp"
                android:paddingLeft="15dp"
                />
            <TextView 
                android:id="@+id/ITEMVIEW_TEXT2_lblText2" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20sp"
                android:textColor="#ff385487"
                android:gravity="right"
                android:paddingRight="15dp"
                />
        </TableRow>
    </TableLayout>
</LinearLayout>

EDIT

我已尝试按照建议herehere,但两者都没有工作。


EDIT

我真的希望在此实现的是,列出两栏案文,一栏与左栏和另一栏。 为实现这一点,我表示出更好的布局,即不使用表态,因此,我的名单上各点仍可点击,也使用较少的意见,这样也会提高效率,这就是:

<?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="wrap_content"
    android:orientation="horizontal" >
            <TextView 
                android:id="@+id/ITEMVIEW_TEXT2_lblText" 
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:textSize="20sp" 
                android:paddingRight="5dp"
                android:paddingLeft="15dp"
                />
            <TextView 
                android:id="@+id/ITEMVIEW_TEXT2_lblText2" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20sp"
                android:textColor="#ff385487"
                android:gravity="right"
                android:paddingRight="15dp"
                />
</LinearLayout>

这并不是表态使名单上的物品无法点击的问题的解决办法,但我在此指出,如果其他人想说明如何做类似规定的话。

最佳回答

我在使用表Layout和表Row的组合处理类似问题。

My solutions was the following: TableRow seems not to have its own Selector and because of this even if you define it as clickable and focusable, you will never see a visual difference. I assigned a background to the TableRow that is comparable to the one that is used by a GridView (can be found in the SDK under android-sdk-windowsplatformsandroid-10data esdrawablegrid_selector_background.xml).

之后,它完全可以集中处理,可以点击。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签