2013-04-08 3 views
-3

에 추가 할 수 있습니다. toString() 메소드로 링크 버튼을 추가 한 다음 listview에 추가하는 방법을 제안합니다. 버튼을 클릭하면 새로운 활동이 시작됩니다. 제발 제안 해주세요. 나는 고치고있다.우리는 toString() with Dynamic Link 버튼을 android

+0

버튼에 밑줄이 그어진 문자열 (링크)이 포함 된 텍스트가 있어야 함을 의미합니다. – boburShox

답변

0

당신은 ... listactivity 클래스를 확장하여이 작업을 수행 할 수 있습니다

은 ... 클래스를 확장하고 listitemclick() 함수를 오버라이드 (override)

하고 있다는 점에서

...

하는 것은 새로운 시작 활동 ... 의도 i = 새로운 의도 (this, yourclass.class); startActivity (i);

1

글쎄, 당신은 첫째로, 당신의 목록보기에 대한 항목 레이아웃을 만들 것입니다 : 여기

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Show link1" 
      /> 
</LinearLayout> 

이 레이아웃의 ListView에 있습니다 :

<ListView 
    android:id="@+id/ListView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 
    </ListView> 

활동 파일에서

myAdapter adapter = new myAdapter(
      context, R.layout.your_list_item, buttonStrings); 
ListView listView = (ListView) findViewById(R.id.ListView1); 
    listView.setAdapter(adapter); 
    listView.setOnItemClickListener(new OnItemClickListener() { 

     @Override 
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
      // do your logic here with position or id 
      Intent myIntent = new Intent(currentActivity.this, nextActivity.class); 
      startActivity(myIntent); 
     } 
    }); 

MyAdapter에서 목록 항목을 재생할 수 있습니다 (이 경우 버튼에 이름을 지정하십시오)