๋ฐ˜์‘ํ˜•

ListView 2

์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ ๋งŒ๋“ค๊ธฐ list view ์— checkbox ๋„ฃ์–ด๋ณด๊ธฐ

์•ฑ์„ ๋งŒ๋“ค๋‹ค ๋ณด๋ฉด listview ํ˜น์ธ recyclelistview ๋“ฑ์„ ์‚ฌ์šฉํ•  ์ผ์ด ์žˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ๊ทธ ์•ˆ์— ์žˆ๋Š” item ์œผ๋กœ checkbox, button ๋“ฑ์„ ๋„ฃ์–ด ํ™”๋ฉด์„ ๊ตฌ์„ฑํ•ด ๋ณด๋ฉด (focus ๊ฐ€ ๋„๋‹ฌํ•˜๋Š” ๊ฒƒ๋“ค) listview ์˜ item click ์ด ์ œ์–ด๋˜์ง€ ์•Š๊ณ  ๊ทธ ์•ˆ์— ์žˆ๋Š” checkbox๋‚˜ button ๋“ฑ์ด ํด๋ฆญ ๋˜๋Š” ํ˜„์ƒ์„ ๋ณด์ธ๋‹ค. ์ด๋Ÿด ๋–„ ์–ด๋–ป๊ฒŒ ํ•˜๋ฉด listview ์˜ item ์œผ๋กœ ์ œ์–ด๋ฅผ ์˜ฎ๊ธธ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ธ๊ฐ€์— ๋Œ€ํ•œ ๊ณ ๋ฏผ์ด ์ƒ๊ธด๋‹ค. ๊ตฌ๊ธ€์‹ ์—๊ฒŒ ๋ฌผ์–ด๋ณด๊ณ  ์ฐพ์•„๋ณด๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ๊ธฐ๋Š” ํ•˜์ง€๋งŒ, ๊ทธ๋Ÿด ์‹œ๊ฐ„์ด๋ฉด ๊ฐ„๋‹จํ•˜๊ฒŒ... checkbox ๋‚˜ button ์—๊ฒŒ focus๊ฐ€ ๊ฐ€์ง€ ๋ชปํ•˜๊ฒŒ false ์ฒ˜๋ฆฌ๋ฅผ ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด๋‹ค. click ๋„ ๋ชปํ•˜๊ฒŒ false ์„ ํ•ด ์ค€๋‹ค. ๊ทธ๋ฆฌ๊ณ  listview..

์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ ๋งŒ๋“ค๊ธฐ Recycle view ์™€ list view ์˜ ์ฐจ์ด๊ฐ€ ๋ญ˜๊นŒ ?

View rootView = LayoutInflater.from(context).inflate(R.layout.row_timeline, null, false); RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); rootView.setLayoutParams(lp); return new TimeLineViewHolder(rootView, viewType); ์•ฑ์„ ๊ตฌํ˜„ํ•˜๋‹ค ๋ณด๋ฉด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ชฉ๋ก ํ˜•ํƒœ๋กœ ๋ณด์—ฌ ์ฃผ์–ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์™•์™• ๋ฐœ์ƒ ํ•˜๊ฒŒ ๋œ๋‹ค. ์ด๋Ÿฐ ๊ฒฝ์šฐ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š”๊ฒƒ์ด ์˜ˆ์ „์—๋Š” listview ์„ ๋งŽ์ด ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ,..

๋ฐ˜์‘ํ˜•