作者tga123 (叛帝)
看板AndroidDev
標題[問題] RadioButton對齊問題?
時間Thu Feb 20 15:50:22 2014
最近我在做生活用的APP
跟大多數APP一樣下方有按鈕可以使用
但是我採用的是RadioButton去做
但是我碰到一個問題
就是我給每一個Button套好style的時候
想要再調整間距..他的圖片卻往左靠..
怎麼調整都一樣...
後來就直接修改圖片的大小去座間距了..
我有試著使用rameLayout去排版
這樣就可以強制圖片置中又可以調整間距了..
但是這樣做我的Button會沒有任何反應..
一定要把Button套到RadioGruop下才會有反應..
也就是說在RadioGroup與RadioButton中間有格Layout就會造成BUG?
<RadioGroup
android:id = "@+id/radioGroup1"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "@color/gray_percent"
android:orientation = "horizontal" >
<FrameLayout
android:layout_width = "0dip"
android:layout_height = "wrap_content"
android:layout_weight = "1" >
<RadioButton
android:id = "@+id/radio0"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_gravity = "center_horizontal"
android:button = "@drawable/rb_temp1"
android:checked = "true"
android:gravity = "center" />
</FrameLayout>
<FrameLayout
android:layout_width = "0dip"
android:layout_height = "wrap_content"
android:layout_weight = "1" >
<RadioButton
android:id = "@+id/radio0"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_gravity = "center_horizontal"
android:button = "@drawable/rb_temp1"
android:gravity = "center" />
</FrameLayout>
</RadioGroup>
有沒有鄉民能給些建議呢?
--
ボ ◢ ◥══
◢ ◥═══
◢ ◥◣ ══
◥◣◢◤◣
═ ◣◢═Vocaloi
d╮
║
◣ ◤◥ ◢◢◢▼ quetzal◤◥◥﹨◣ ◢◥◤ ◥ ▼◥ ◣◢ ║
║
● ●▼ ● ●◥ ロ ● ● ;│ ▼◥︽﹨ ◆▼◥▼﹨ ▃▃
║
◣▄ ◢◤ ◤◣▆ ◢◥ ◥
◣▃ ▉
◤ ═● ● ▌ ◤● ● ▌ ◢
ド!
║
◤◤◢ ◣
カ ████▆≡ ◤▆ ◥ ◢
◣▁ ▉
◥ ◣▄ ▉
◤ ▅▅
╰══
◣︶●═══
▊█▎◥◣══
▼ ◢/△ ◤═イ═△▅/◥══
△▅/◣ ═══
╯
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.34.164.154
1F:→ laiis:RadioButton: android:background="@null" ?? 02/21 00:55
2F:→ tga123:應該是說...有沒有辦法讓Framelayout不影響BUTTON 02/21 09:43
3F:→ tga123:或是有方法能調整button的位置而不會失去正常功能 02/21 09:44
4F:→ ted66:Framelayout裡面再包一層Relative或LinearLayot排版 02/21 10:34
5F:→ tails32100:之前有遇過,後來是使用TextView加上 02/21 10:45
6F:→ tails32100:android:drawableTop之類的屬性解決的 02/21 10:45
7F:→ tails32100:所以RadioGroup的功能是自己寫@@ 02/21 10:46
8F:→ tga123:恩恩我試試看包兩層~..其實我在想乾脆就不要用這個BUTTON 02/21 13:32
9F:→ tga123:直接用普通的button去模擬編寫他的狀態就好了LOL 02/21 13:33
10F:→ ted66:有圖的話我是用兩層加imageview這樣比較不會跑圖 02/21 14:49