我已將線性圖層設置爲可點擊,並希望它像按鈕一樣操作並開始新的活動。但是我得到錯誤。下面是將.xmlAndroid可點擊圖層
<LinearLayout
android:id="@+id/llproduct1"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:clickable="true">
<ImageView .... />
<TextView .... />
</LinearLayout>
這是的.java 按鈕bProduct1 =(按鈕)findViewById(R.id.llproduct1)的一部分; bProduct1.setOnClickListener(新View.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("com.testing.PRODUCTDESCRIPTION"));
}
出了什麼問題
什麼是你的錯誤? –
ClassCastException顯然 – Blackbelt