作者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