나는 정상적인 방식으로 구현 한 목록보기가 있습니다. 편집보기와 단추를 목록보기의 맨 위에 표시하고 목록보기의 모든 항목에는 표시하지 않습니다. 누군가가편집 상자와 버튼을 헤더로 사용하는 Android보기
1
A
답변
1
내가 해석 할 수있는 것에 따라 당신은 다음과 같은 것을 시도 할 수있다. 이 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF000000" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout1"
android:orientation="horizontal"
>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/et1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt1"
android:text="ClickMe"
/>
</LinearLayout>
<ListView
android:id="@+id/list"
android:layout_below="@id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#000000" />
</RelativeLayout>
필요에 따라 일부 매개 변수를 사용자 정의해야 할 수도 있습니다. 희망이 도움이됩니다.
편집 1 : 해당 Java 클래스
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class AtoZActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView lv=(ListView) findViewById(R.id.list);
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
// Assign adapter to ListView
lv.setAdapter(adapter);
}
}
그리고 매니페스트
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".AtoZActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
+0
도움 주셔서 감사합니다 – user1092042
1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/listado_ly_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal" >
<EditText
android:id="@+id/listado_tb_filtro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.45" android:layout_gravity="center_vertical">
</EditText>
<Button
android:id="@+id/listado_iv_search"
android:layout_width="48dp"
android:layout_height="48dp" android:background="@android:drawable/ic_menu_search"/>
</LinearLayout>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:minHeight="200sp"
android:orientation="horizontal" >
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:choiceMode="singleChoice"
android:drawSelectorOnTop="false"
android:minHeight="200sp" >
</ListView>
</LinearLayout>
1
이와 노력이 목적을 위해 샘플 코드로 날을 제공 할 수있다 ..
<?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="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/edtxt"
android:layout_width="100dp"
android:layout_height="50dp"
android:inputType="none" />
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginRight="3dp"
android:layout_marginTop="2dp"
android:text="button"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
</ListView>
</LinearLayout>
</LinearLayout>
자바 파일이
public class example extends Activity {
private ListView listView;
static String[] names;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
listView = (ListView) findViewById(R.id.phlist);
Button btn = (Button) findViewById(R.id.btn);
EditText ed = (EditText)findViewById(R.id.edtxt);
names = new String[] { "name1", "name2", "name3", "name4" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
lv.setAdapter(adapter);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//write Ur Code for Button Clik
}
});
}
}
모양을이 link.it 월 참조 유용한 .. enter link description here
+0
edittext와 버튼을 헤더로 사용하고 목록보기를 채우기 위해 java 코드를 게시 해주세요. – user1092042
관련 문제
- 1. CSS의 텍스트 상자와 버튼을 구분하십시오
- 2. 편집 가능한 행에 라디오 버튼을 사용하는 jqGrid
- 3. 편집 버튼을
- 4. Android보기 애니메이션
- 5. iphone에서 키보드 위쪽에 텍스트 상자와 버튼을 추가하십시오.
- 6. Android보기 도움말
- 7. Android보기 회전
- 8. xml없이 Android보기
- 9. non-xml Android보기
- 10. CSS는 헤더로
- 11. UITableView의 편집 버튼을 제거하십시오
- 12. Android보기 및 필드 만들기
- 13. 편집 버튼을 클릭하면 텍스트 상자가 표시됩니다.
- 14. Android보기 추가 자식
- 15. Android보기 ID 찾기
- 16. Android보기 또는 활동?
- 17. Android보기 state_pressed 파란색 배경
- 18. Android보기 및 화면 오리엔테이션
- 19. Android보기 방향 상수보기
- 20. Android보기 라이프 사이클
- 21. Android보기 가시성 GONE
- 22. 모든 Android보기 속성을 스타일에 넣어야합니까?
- 23. Android보기 계층 구조 작동 방법
- 24. 편집 페이지에 버튼을 추가하는 방법
- 25. XTraGrid에서 "필터 편집"버튼을 비활성화하십시오.
- 26. 바 버튼을 사용하여 UItableview 편집
- 27. 라텍스에서 배경색을 헤더로 정의하기
- 28. Google지도의 infoWindow에 콤보 상자와 버튼을 추가하는 방법은 무엇입니까?
- 29. 입력 상자와 버튼을 같은 폭,하지만 난 그것을 원하지 않는
- 30. 어떻게 콘텐츠를 추가, 사용자 정의 대화 상자와 함께, TinyMCE에 사용자 정의 버튼을 사용하는 방법?
에서 통해 UR 현재 작업에 대한 SRC를 제공하고 우리는 더 나은 도움을 줄 수. – Deva
액티비티/레이아웃/매니페스트 항목이 추가되었는지 확인하십시오. – Deva