为什么会发生?我正在点击项目,但它没有响应
而我 调用另一个活动 ,并且还将一些值传递给该活动
看看我的日志说了什么:
I/dalvikvm-heap(27753): Grow heap (frag case) to 28.932MB for 6554896-byte allocation
D/dalvikvm(27753): GC_CONCURRENT freed 0K, 5% free 28662K/29895K, paused 2ms+2ms, total 19ms
D/dalvikvm(27753): WAIT_FOR_CONCURRENT_GC blocked 1ms
D/AbsListView(27753): Get MotionRecognitionManager
E/SpannableStringBuilder(27753): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(27753): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 10 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 8 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 9 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 8 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 9 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 2 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 5 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 2 mFalseSizeCnt:0
D/GestureDetector(27753): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 3 mFalseSizeCnt:0
W/IInputConnectionWrapper(27753): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(27753): setComposingText on inactive InputConnection
代码使用点击任意列表项启动活动:
// selecting single ListView item
ListView lv = getListView();
// Launching new screen on Selecting Single ListItem
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
String name = ((TextView) view.findViewById(R.id.name)).getText().toString();
String emailID = ((TextView) view.findViewById(R.id.emailID)).getText().toString();
String deviceID = ((TextView) view.findViewById(R.id.deviceID)).getText().toString();
String password = ((TextView) view.findViewById(R.id.password)).getText().toString();
// Starting new intent
Intent in = new Intent(LicenseListActivity.this, LicenseCheckActivity.class);
in.putExtra(TAG_NAME, name);
in.putExtra(TAG_EMAIL_ID, emailID);
in.putExtra(TAG_DEVICE_ID, deviceID);
in.putExtra(TAG_PASSWORD, password);
startActivity(in);
}
});
}
activity_license.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
layout="@layout/header" />
<ListView
android:id="@android:id/list"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:divider="#131313"
android:dividerHeight="3dp"
android:layout_below="@+id/header"
android:background="@drawable/background"
android:layout_width="match_parent" />
</RelativeLayout>
activity_license_list.xml: -
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/imageView1"
android:paddingBottom="15dip"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dip"
android:typeface="sans"
android:textSize="30dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/emailID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/name"
android:layout_alignLeft="@+id/name"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/deviceID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/emailID"
android:layout_alignBottom="@+id/emailID"
android:layout_toRightOf="@+id/emailID"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/deviceID"
android:layout_alignBottom="@+id/deviceID"
android:layout_toRightOf="@+id/deviceID"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="@drawable/arrow" />
</RelativeLayout>
清单: -
<activity
android:name="com.m.cam.LicenseCheckActivity"
android:screenOrientation="landscape"
/>
答案 0 :(得分:0)
哦,我的运气不好,我做了愚蠢的错误,我在列表项目中使用图像按钮,而不需要所以我做了更改,imagebutton到imageview并解决了问题!
<ImageView
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="@drawable/arrow" />