小编The*_*oke的帖子

单击单击框获取列标题和行标题

我已经有了选择单元格的功能,使用这个:

$('td').click(function(){
    //do things here
}
Run Code Online (Sandbox Code Playgroud)

我希望它从列的标题中获取文本(这是在thead中,然后是它自己的标记),并且还获得行标题,这是表格中最左边的列,并且也在th标记下表示.

HTML:

<table>
<thead>
<tr>
    <th>Day/Time</th>
    <th>10:00</th>
    <th>11:00</th>
    <th>12:00</th>
</tr>
<tbody>
<tr>
    <th>Monday</th>
    <td>Cell data</td>
    <td>Cell data</td>
    <td>Cell data</td>
</tr>
<tr>
    <th>Tuesday</th>
    <td>Cell data</td>
    <td>Cell data</td>
    <td>Cell data</td>
</tr>
<tr>
    <th>Wednesday</th>
    <td>Cell data</td>
    <td>Cell data</td>
    <td>Cell data</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

javascript jquery html-table

6
推荐指数
1
解决办法
8242
查看次数

无法解析方法findViewByID

我对android开发很新,所以如果我无法理解这里到底发生了什么,我很抱歉.

我已经创建了一个形状,如下所示.它包含在drawable文件夹中的shape.xml中:

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<solid
    android:color="@color/lboro_pink"/>

<stroke
    android:width="50dp"
    android:color="@color/lboro_blue"/>

<padding android:left="1dp"
    android:top="1dp"
    android:right="1dp"
    android:bottom="1dp"/>

<corners
    android:bottomRightRadius="7dp"
    android:bottomLeftRadius="7dp"
    android:topLeftRadius="7dp"
    android:topRightRadius="7dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

现在在我的activity_main.xml中我有这个TextView:

<TextView
    android:id="@+id/grid_1"
    android:background="@drawable/shape"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_weight="1"
    android:text="@string/event_1"/>
Run Code Online (Sandbox Code Playgroud)

现在这是我的MainActivity.java:

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuInflater;
import android.widget.ImageView;
import android.widget.TextView;
import android.content.res.Resources;


public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ImageView image = (ImageView) findViewById(R.id.test_image);

    Resources res = getResources();
    Drawable shape = res. getDrawable(R.drawable.shape); …
Run Code Online (Sandbox Code Playgroud)

java android

0
推荐指数
1
解决办法
2887
查看次数

标签 统计

android ×1

html-table ×1

java ×1

javascript ×1

jquery ×1