我需要创建相同的按钮,如下图所示.Button必须在里面的文字.

当我在进行XML布局时遇到了Button触摸区问题.每个下一个按钮都覆盖前一个带有矩形Button区域的按钮.

是否像我一样在XML标记中放置六边形,以实现像图片中的六边形?请帮助我解决触摸区域的问题,如果可能的话告诉我如何正确创建布局,因为我不确定,因为我做的是正确的.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="?attr/actionBarSize">
<Button
android:id="@+id/button1"
android:layout_width="130dp"
android:layout_height="134dp"
android:background="@drawable/hexagon_shape_img"
android:text="Home page"
android:textSize="@dimen/small_text" />
<Button
android:id="@+id/button2"
android:layout_width="130dp"
android:layout_height="134dp"
android:layout_marginLeft="65dp"
android:layout_marginTop="-20dp"
android:background="@drawable/hexagon_shape_img"
android:text="Tavern"
android:textSize="@dimen/small_text" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) this.Controls.Add(button);
button.Font = new Font("Arial", 8);
button.Name = "btn" + idDanych;
button.Width = 100;
button.Height = 100;
button.Location = new Point(0, 0);
button.Text = "…" + Environment.NewLine + Environment.NewLine + "…";
button.ForeColor = Color.Black;
Run Code Online (Sandbox Code Playgroud)
如何更改按钮第二行文本的字体大小和颜色?
我使用XML在android 5.0中成功创建了一个涟漪按钮.我的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- the flat button to be used in app -->
<!-- define the ripple -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<!-- the ripple object -->
<item android:id="@android:id/mask">
<!-- button shape (w/ radius) -->
<shape android:shape="rectangle">
<!-- radius of vertices -->
<corners
android:topLeftRadius="7dp"
android:topRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp" />
<!-- color accent (not working) -->
<solid android:color="?android:colorAccent" />
</shape>
</item>
</ripple>
Run Code Online (Sandbox Code Playgroud)
我的按钮有问题:按钮的背景颜色不会改变.我也尝试过:
<solid android:color="#0000ff" />
Run Code Online (Sandbox Code Playgroud)
背景仍然保持透明(colorAccent也不起作用).
如果没有通过,我应该如何将矩形(按钮的)背景设置为蓝色
<solid/>
Run Code Online (Sandbox Code Playgroud)
属性?
谢谢
所以这是我的第一个应用程序,我正在尝试编码,需要一些按钮帮助.在寻找答案后,我找不到一个我理解的答案.我希望能够为应用程序创建不同的页面并将imagebuttons链接建立到这些页面.这是我按钮的最基本代码.请尝试解释在哪里放置代码等.提前感谢.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:background="@drawable/home_button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:nestedScrollingEnabled="true" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我正在尝试让标准的Android ToggleButton呈现某种自定义样式:在未选中状态下,不显示边框/背景填充,在选中状态下,背景填充显示,当按下(选中或未选中)时会产生波纹效果显示为从一种状态过渡到另一种状态。
我已经做好了一切,大部分情况下都使用它作为ToggleButton的背景:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ripple" android:state_pressed="true"/>
<item android:drawable="@drawable/checked_bg" android:state_checked="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
波纹:
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight" >
<item
android:id="@android:id/mask">
<color
android:color="@android:color/white" />
</item>
</ripple>
Run Code Online (Sandbox Code Playgroud)
checked_bg:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="?android:attr/colorControlHighlight" />
</shape>
Run Code Online (Sandbox Code Playgroud)
但是,当我从选中状态转到未选中状态时,涟漪将实心填充应用于与选中按钮状态填充颜色不匹配的按钮,因此它似乎立即从一种颜色“跳转”到另一种颜色。我相信这是因为我在检查状态背景填充和波纹颜色上都使用了colorControlHighlight,因此波纹最终以该颜色开始,并以另一种稍微浅一点的颜色开始...
但是,我不能简单地将选中状态的背景填充更改为这种较浅的颜色,因为这会使我检查/打开按钮时看起来很奇怪-它会以较浅的颜色开始,与选中的背景填充相匹配,然后变成较深的颜色,然后立即再次跳至较浅的颜色。
有没有一种干净的方法来解决这个问题?还是我一端卡住了颜色变化?
或者,我可以使用两种不同的纹波,一种用于按下= true和checked = false,另一种用于按下= true和checked = true的情况,对吗?
我正在尝试在我通过Sublime Text2编码并通过Apache运行的网站上实施Google+登录/登录按钮.我是非常新的Web开发和使用localhost/http://127.0.0.1.
所以我的问题就出现了,因为当我在"索引"Chrome HTML文档中有按钮时,它运行正常,我可以使用我的Google +帐户登录.
但是,如果我将网页中的按钮链接到该网页(新文档"登录"Chrome HTML文档),则登录不会通过.它会提取我的帐户,但它不会让我完全登录.
错误错误:origin_mismatch
我想我必须在我的API和Auth中使用我的证书中的JavaScript起源中更改一些内容,但它不会让我添加类似http://localhost/signin.html的内容 .
Origins URIs must not contain a path: http://localhost/signin.html
Run Code Online (Sandbox Code Playgroud)
我怎么能让这个网页访问?
谢谢!
我已经搜索了所有这些,但我只能找到如何更改/修改输入,选择和按钮元素的样式.
我想要做的是在所有浏览器和移动设备上删除除值本身以外的所有阴影,边框,背景,图标等.
我有这个代码块,它帮助按钮识别它所在的行.但是,当我隐藏上面的行时,按钮引用该隐藏的行.
例如:如果按钮在第20行并且我隐藏第19行,则单击该按钮将返回第19行.如果我隐藏第19行和第18行,则该按钮返回第18行.
这真的很奇怪.
这是我用来创建按钮的块:
Sub AddButtons()
Dim button As button
Application.ScreenUpdating = False
Dim st As Range
Dim sauce As Integer
For sauce = 10 To Range("F" & Rows.Count).End(xlUp).Row Step 1
Set st = ActiveSheet.Range(Cells(sauce, 11), Cells(sauce, 11))
Set button = ActiveSheet.Buttons.Add(st.Left, st.Top, st.Width, st.Height)
With button
.OnAction = "GoToIssue.GoToIssue"
.Caption = "Go To Source"
.Name = "Button" & sauce
End With
Next sauce
Application.ScreenUpdating = True
End Sub
Run Code Online (Sandbox Code Playgroud)
这里是一个块,它会在点击按钮后返回按钮的行ID:
Sub GoToIssue()
Dim b As Object
Dim myrow As Integer …Run Code Online (Sandbox Code Playgroud) 我在AngularJS中有一个包含多个条目的列表,每个条目都有一个按钮.单击按钮时,应用程序将执行一些操作,然后成功完成后,应禁用该按钮.
我模板中有趣的部分如下所示:
<li ng-repeat="item in items">
<span>{{item}}</span>
<button ng-click="doSomeStuff(item)">Request</button>
</li>
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用ng-if指令,但当然每个按钮都会消失.
以前,我考虑过使用原始Javascript或jQuery的解决方案,因为只需通过其id修改按钮就很容易了.但AngularJS是否提供了解决方案?
我使用以下XML制作Android Button.
但是当我运行Device,Samsung Duos时.它显示完全不同.

我该如何设置边框.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="3dp"
android:color="#d78d79" />
</shape>
Run Code Online (Sandbox Code Playgroud)
我也在XML中遇到错误,但它的工作正常.当鼠标悬停在错误上时没有显示任何内容.
任何人都可以帮忙吗?