丸みのある境界線でレイアウトを作成したいと思います。 LinearLayout
に特定の半径の半径を適用するにはどうすればよいですか?LinearLayoutに角の半径を適用する方法
87
A
答えて
214
drawableフォルダにXMLファイルを作成できます。 shape.xml
shape.xml
では、例えば、それを呼び出す:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#888888" >
</solid>
<stroke
android:width="2dp"
android:color="#C4CDE0" >
</stroke>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" >
</padding>
<corners
android:radius="11dp" >
</corners>
</shape>
<corner>
タグがあなたの具体的な質問です。
必要に応じて変更してください。
そして、あなたのwhatever_layout_name.xml
中:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="5dp"
android:background="@drawable/shape" >
</LinearLayout>
これは、私は通常私のアプリの中で何をすべきかです。これが役に立ちますようお願いいたします。
11
レイアウトの背景としてShape Drawableを使用し、そのcornerRadiusを設定します。 Check this blog詳細なチュートリアル
http://stackoverflow.com/questions/1683185/android-listview-with-rounded-corners – Rajesh
で既に回答されている質問をご覧ください。http:// www。 gadgetsaint.com/tips/rounded-corners-views-layouts-android/#.WPZ2QVN97BI – ASP