Android 让按钮透明?
我如何去除按钮周围的白色部分?我不希望按钮是透明的,但我希望它周围有白色的部分。我在按钮后面有谷歌地图 我在按钮上尝试了android:background=“@android:color/transparent”,但只有按钮变为透明(而不是周围的白色部分) 如何在XML中实现这一点Android 让按钮透明?,android,button,Android,Button,我如何去除按钮周围的白色部分?我不希望按钮是透明的,但我希望它周围有白色的部分。我在按钮后面有谷歌地图 我在按钮上尝试了android:background=“@android:color/transparent”,但只有按钮变为透明(而不是周围的白色部分) 如何在XML中实现这一点 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MyLocation" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:gravity="center" >
<Button
android:id="@+id/filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="filterMenu"
android:text="@string/filter_button" />
</FrameLayout>
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</LinearLayout>
如何将
RelativeLayout
的背景设置为透明
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent" >
<Button
android:id="@+id/filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:onClick="filterMenu"
android:text="@string/filter_button"
/>
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
这个怎么样
Button filter = (Button) findViewById(R.id.filter);
filter.setBackgroundColor(Color.TRANSPARENT);
试试这个:
MybuttonName.getBackground().setAlpha(0)
0=完全透明。
255完全不透明。试试这个
android:background="@android:color/transparent"
这是完整的XML吗?如果没有发布全部内容..整个XML现在都打开了。这不是正确的XML。请将framelayout背景设置为transparentI,按钮保持不变。谢谢。谢谢回复,按钮还是原来的。
android:background="@android:color/transparent"