我从XML获得了一个视图,其代码如下:
Button view = (Button) LayoutInflater.from(this).inflate(R.layout.section_button, null);
Run Code Online (Sandbox Code Playgroud)
我想为按钮设置一个"样式"我怎么能在java中这样做,因为我想使用几个样式我将使用的每个按钮.
我目前正在使用ListView,我使用RelativeLayout来填充自定义适配器.问题是RelativeLayout没有显示边距.
这是我的相对布局声明:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ArticleSnippet"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip"
android:layout_marginTop="10dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:background="@drawable/background_snippet" >
...
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
ListView声明:
<ListView
android:id="@+id/ArticleSnippets"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#fff"
android:dividerHeight="0sp">
</ListView>
Run Code Online (Sandbox Code Playgroud)
有什么特别的事要做,以使ListView中的边距有效吗?
在此先感谢您的帮助,
林特(Dusariez JF)