[英]android - apply button default style to linear layout
I want to have a button with multiple TextViews - so I figured I should have a linearlayout and put Textviews inside. 我想要一个带有多个TextViews的按钮-所以我认为我应该有一个linearlayout并将Textviews放进去。
I want the linearlayout to look exactly like the button, and I can't achieve that. 我希望linearlayout看起来完全像按钮,但是我无法实现。
Here is how the button "Add Ride" looks like (not the blue title, the grey button): 这是“添加骑行”按钮的外观(不是蓝色标题,是灰色按钮):
and the button code is like this, without any style: 按钮代码是这样的,没有任何样式:
<Button
android:id="@+id/btnAddRide"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="Add Ride" />
How do I make the linearlayout look like this?? 如何使linearlayout看起来像这样?
thanks! 谢谢!
This is probably the default look of the button. 这可能是按钮的默认外观。 So, if you want your linearlayout too have a look like this then I guess, you will have to take the color of button and have that as background of linearlayout something like
因此,如果您也希望LinearLayout看起来像这样,那么我想,您将必须采用按钮的颜色,并将其作为linearlayout的背景,例如
<LinearLayout
android:id="@+id/lin_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/<btn_bg_color>"
android:orientation="vertical"
/>
我认为您应该为线性布局添加的内容是:
android:theme="@style/Widget.AppCompat.Button"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.