textview.xml中定义
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="hello"
android:paddingTop="15dip"
android:paddingBottom="15dip"
android:textSize="15sp"
android:background="@drawable/rounded_corner_view"
>
</TextView>
在java中获得
TextView bottomInfoView = (TextView) LayoutInflater.from(getActivity()).inflate(
R.layout.bottom_3d_info_view, null);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
bottomInfoView.setLayoutParams(lp);