Android浮动配置文件图像位于XML中的片段/活动外部
我正在尝试构建一个配置文件ui,这样用户图像就在剩余内容的外面/上面,就像在这个图像中一样 我使用了一个底部的对话框片段并创建了必要的xml小部件,但它不是这样显示的。如何堆叠这种类型的ui 到目前为止,我的xml实现如下:Android浮动配置文件图像位于XML中的片段/活动外部,android,user-interface,user-profile,bottom-sheet,Android,User Interface,User Profile,Bottom Sheet,我正在尝试构建一个配置文件ui,这样用户图像就在剩余内容的外面/上面,就像在这个图像中一样 我使用了一个底部的对话框片段并创建了必要的xml小部件,但它不是这样显示的。如何堆叠这种类型的ui 到目前为止,我的xml实现如下: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="bottom"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/imageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom|center_horizontal"
android:background="@android:color/transparent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/infoCIV"
android:layout_width="100dp"
android:layout_height="100dp"
tools:src="@drawable/ic_players"
app:civ_border_color="@color/colorPrimary"
app:civ_border_width="1dp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/date_dialog_bkg"
android:layout_below="@+id/imageLayout"
android:layout_marginTop="1dp">
<android.support.design.widget.TabLayout
android:id="@+id/playerTabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/actionBarSize"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabIndicatorHeight="3dp"
app:tabIndicatorColor="@color/colorPrimary"
app:tabTextColor="@color/text_color"
app:tabSelectedTextColor="@color/colorPrimary"
android:background="@drawable/tabs_underline_bkg"/>
<android.support.v4.view.ViewPager
android:id="@+id/playerVP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="100dp"
android:layout_below="@+id/playerTabs"/>
</RelativeLayout>
</RelativeLayout>
片段java文件只有xml对象,使用findviewbyid和viewpageradapter添加选项卡布局片段以添加片段回答:
将以下内容添加到您的样式中:
<style name="CustomBottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/CustomBottomSheetStyle</item>
</style>
<style name="CustomBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@android:color/transparent</item>
</style>
你得到了什么结果?在此添加底部工作表对话框的xml代码这是xml代码。输出渲染良好,但与上面的图像不同,它的内部有图像@VadimEkslerI在我的适配器代码中添加片段时已经这样做了,比如fragment.setStyleDialogFragment.STYLE\u NORMAL、android.R.STYLE.Theme\u Material\u Light\u NoActionBar;有效吗?将setStyle添加到扩展自BottomSheetDialogFragment的类中?第二个参数必须是覆盖BottomSheet默认样式的自定义样式。ModAlt这是您的问题-fragment.setStyleDialogFragment.style_NORMAL,android.R.style.Theme_Material_Light_NoActionBar;这个片段已经分离了类?您需要像我的回答中那样添加customStyle,并在show方法之后使用它。
<style name="CustomBottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/CustomBottomSheetStyle</item>
</style>
<style name="CustomBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@android:color/transparent</item>
</style>
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(BottomSheetDialogFragment.STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme);
}