回答
你可以试试这个布局,它反映了按您的要求
<?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="match_parent"
android:layout_margin="15dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/border"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:padding="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Label 1: Value 1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Label 2: Value 2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Label 3: Value 3"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text=" Details "
android:layout_marginLeft="15dp"
android:background="#ffffff"
android:textSize="17sp" />
</RelativeLayout>
XML border.xml的
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="2dp"
android:color="#cdcdcd" />
</shape>
希望这有助于你以某种方式。
非常感谢!! ..它的工作!! ... – Jignesh
欢迎亲爱的... –
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dip">
<TextView
android:id="@+id/txt_notificaiton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:background="@drawable/button_effect_white"
android:padding="16dip"
android:text=""
android:textColor="@drawable/text_color_white"
android:textSize="22dip" />
<TextView
android:id="@+id/txt_createddateandtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:padding="16dp"
android:text=""
android:textSize="12dip" />
<TextView
android:id="@+id/iv_read_unread"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|top"
android:layout_marginRight="10dp"
android:background="@color/white"
android:text="Details" />
</FrameLayout>
</LinearLayout>
您可以张贴布局的截屏内textviews,按要求 – Jignesh
它不工作你可以根据需要将imageview更改为TextView。 – PriyankaChauhan
@Jignesh请检查更新代码 – PriyankaChauhan
添加边框到Android的TextView,我们需要下绘制的文件夹中创建包含形状矩形文件的XML并将其设置为背景,以TextView的。
<stroke> tag is used to set the border width and color.
border.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="2dp"
android:color="#000000" />
</shape>
activity_main.xml中
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp" xmlns:tools="http://schemas.android.com/tools" >
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/border"
android:gravity="center"
android:text="Android Programming is fun!!" />
</RelativeLayout>
如果你想要把一个边界的任何布局而不是TextView的,使布局背景
**android:background="@drawable/border"**
textbackground.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true">
<shape >
<solid android:color="@color/white"/>
<corners
android:radius="1dp"/>
</shape>
</item>
<item android:state_focused="true" >
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/white"/>
<corners
android:radius="1dp"/>
</shape>
</item>
<item android:state_focused="false" >
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#c38416"/>
<stroke
android:width="3dp"
android:color="@color/bordercolor" />
<corners android:radius="3dp" />
<padding
android:bottom="6dp"
android:left="6dp"
android:right="6dp"
android:top="6dp" />
</shape>
</item>
<item android:state_pressed="false" >
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#c38416"/>
<corners
android:radius="1dp"
/>
</shape>
and
<TextView
android:background="@drawable/textbackground"
/>
无效,请检查新图片 – Jignesh
创建绘制文件,并在文件中添加以下代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="2dp" />
<stroke
android:width="2px"
android:color="@color/colorGreyBrown" />
<solid android:color="#ffffff" />
</shape>
那么这可绘制文件作为背景设置为您的TextView
<TextView
android:id="@+id/Textview_register_als"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/foodynet_rounded_corner_brown_color_border_white_bg"
android:gravity="center"
android:text="@string/string_text_register"
android:textColor="@color/colorGreyBrown"
android:textSize="@dimen/text" />
无效,请检查新图片 – Jignesh
- 1. 安卓:添加边框的ListView项目
- 2. 安卓:多TextView的
- 3. 安卓:添加边框和舍入到recyclerView项目
- 4. 安卓textview环绕textview
- 5. 冻结的TextView +安卓
- 6. 安卓在ImageView中绘制边框
- 7. 添加边框
- 8. 从方法(安卓)Chaning TextView
- 9. 如何textview和安卓
- 10. 添加安卓项目
- 11. Cordova添加安卓平台
- 12. 添加EDITTEXT在HeaderListView安卓
- 13. GradientDrawable边框textview croped
- 14. 安卓谷歌地图多边形添加圆孔
- 15. html添加边框
- 16. 安卓的TextView没有滚动自动
- 17. TextView中是不可见的安卓5.1.1
- 18. 安卓:TextView的集y坐标动态
- 19. 安卓:TextView的超级链接
- 20. 安卓:Java的:TextView中不会变色
- 21. jQuery的添加边框表
- 22. 添加边框的div
- 23. 安卓:在片段动态添加的TextView - 保持刚开空引用
- 24. 安卓:编程添加视图的RelativeLayout
- 25. 安卓:外发光添加到ImageButton的
- 26. 安卓:从模板文件创建的TextView和附加到现有的TextView
- 27. 边界问题(安卓)
- 28. 安卓:我的TextView如何把与TextView的
- 29. 安卓复选框
- 30. 安卓:想关于对话框添加按钮困境
可以使用形状绘制 – KrishnaJ
给予的TextView的背景为白色,然后把它放在箱子 –
上面可以请详细说明,我要补充的是矩形 – Jignesh