20÷tan35º,具体该怎么算

打造一款计算器(1)界面设计
  学习android有一段时间了,计划打造一款简单易用的计算器,界面及功能从最基础的样式开始,后续实现的过程中再慢慢进行完善。
  欢迎感兴趣的朋友一起讨论、学习,大家共同进步。
  写这篇文章时,还没有对计算器界面上按钮对应的功能进行实现,只是给出界面设计及布局生成(xml代码的编写)过程中需要注意的地方。
1、界面设计布局代码
1 &TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tablelayout_calculator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*" &
&TextView android:id="@+id/text_input"
android:layout_weight="3"
android:layout_height="0dp"
android:layout_width="match_parent"
android:hint="input something"
android:gravity="bottom|right"
android:textSize="@dimen/text_size"
android:textColor="#0000ff" /&
&TableRow android:layout_weight="1" &
&Button android:id="@+id/btn_sin"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="sin"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&Button android:id="@+id/btn_cos"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="cos"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&Button android:id="@+id/btn_tan"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="tan"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&Button android:id="@+id/btn_cls"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="C"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&Button android:id="@+id/btn_del"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="Del"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&/TableRow&
&TableRow android:layout_weight="1" &
&Button android:id="@+id/btn_pia"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="@string/calculator_pia"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_lna"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="ln"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&Button android:id="@+id/btn_log"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="log"
android:textSize="@dimen/text_size"
android:textAllCaps="false" /&
&Button android:id="@+id/btn_fac"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="!"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&Button android:id="@+id/btn_add"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="+"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&/TableRow&
&TableRow android:layout_weight="1"&
&Button android:id="@+id/btn_7"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="7"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_8"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="8"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_9"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="9"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_pow"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="^"
android:textSize="@dimen/text_size"
android:textColor="#ff9933"/&
&Button android:id="@+id/btn_sub"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="-"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&/TableRow&
&TableRow android:layout_weight="1"&
&Button android:id="@+id/btn_4"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="4"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_5"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="5"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_6"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="6"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_sqr"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="@string/calculator_sqr"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&Button android:id="@+id/btn_mul"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="*"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&/TableRow&
&TableRow android:layout_weight="1"&
&Button android:id="@+id/btn_1"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="1"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_2"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="2"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_3"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="3"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_lef"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="("
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&Button android:id="@+id/btn_div"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="/"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&/TableRow&
&TableRow android:layout_weight="1"&
&Button android:id="@+id/btn_0"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="0"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_00"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="00"
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_poi"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="."
android:textSize="@dimen/text_size" /&
&Button android:id="@+id/btn_rig"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text=")"
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&Button android:id="@+id/btn_equ"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="="
android:textSize="@dimen/text_size"
android:textColor="#ff9933" /&
&/TableRow&
201 &/TableLayout&
2、xml代码简单分析
  针对计算器这种功能性按钮呈类似表格状分布的应用程序界面,笔者首先想到的布局组件就是TableLayout和TableRow。
  从xml布局代码或开头的界面示意图可以看出,整体界面的布局采用的组件如下:
  a、根元素是1个TableLayout,并且设置了属性android:stretchColumns="*",保证其子组件TableRow中的元素所占列宽相同;
  b、第二级子组件为1个TextView和6个TableView,前者TextView用来显示用户输入内容和最终计算结果;后者每个TableRow各有五个按钮,即总共30个按钮;
  下面主要介绍一下布局代码中需要注意的地方。
  a、第8、9行对于TextView组件的高度属性设置为android:layout_weight="3" , android:layout_height="0dp",结合后面的5个TableRow组件的高度属性设置android:layout_weight="1",那么整个TableLayout的所占的界面高度被分为了8份,最终效果为1个TextView占总高度的3/8,5个TableRow各占总高度1/8;
  b、第22行对于按钮文本内容显示的大小写属性设置为android:textAllCaps="false",false表示最终显示在按钮的文本内容的大小写和定义时一致,如果不设置的话默认为true,那么程序会自动将本文全部转为大写;
  c、第20、26等行是在xml布局文件中直接对按钮文本进行设置,规范的做法应该是在资源文件values/strings.xml(名称自取,不固定)文件中进行定义,然后在xml文件中利用@string/xxx(Java代码中是R.string.xxx)的形式进行获取。当然,有些字串是无法直接在xml布局文件中进行输入的,如&(pi,53行)、&(sqrt,130行)等,这时就必须在资源文件中对其进行定义,利用机器能够识别的十进制编码。定义代码如下:
1 &string name="calculator_pia"&π&/string&
2 &string name="calculator_sqr"&√&/string&
  d、当然,可以将每个按钮或者每个TableRow结合styles等属性分别定义成可复用的xml文件,那样的话在最终的界面布局文件activity_calculator.xml中只需要利用include关键字导入定义好的TableRow组件对应的文件名即可。这部分设计本文没有给出,后面实现过程中如有必要的话会进行实现并写入文章中;
  e、虽然按钮对应的功能实现本文没有涉及,但其对应的id命名这里先解释一下。像btn_0、btn_1这种很好理解,对应的按键是数字0、1,而像&、&、.这类按钮的id名称为btn_pia、btn_sqr、btn_poi。即除了数字一目了然外,其余的命名均采用btn_xxx的形式,这样做的目的是在后续的Java文件中获取组件id时有个统一的标准,毕竟组件很多的情况下有个可以参考的线索是比较省脑细胞的。
3、字串赋值规范化  
  既然说到字串等资源定义的规范化,接下来就将上面介绍的按钮文本直接赋值转为资源文件+Java代码的设置方式。
  首先将所有按钮用到的字串统一定义到资源文件values/strings_calculator.xml中,具体如下。
1 &?xml version="1.0" encoding="utf-8"?&
2 &resources&
&string-array name="strings_calculator" &
&item&sin&/item&
&item&cos&/item&
&item&tan&/item&
&item&C&/item&
&item&Del&/item&
&item&π&/item&
&item&ln&/item&
&item&log&/item&
&item&!&/item&
&item&+&/item&
&item&7&/item&
&item&8&/item&
&item&9&/item&
&item&^&/item&
&item&-&/item&
&item&4&/item&
&item&5&/item&
&item&6&/item&
&item&√&/item&
&item&*&/item&
&item&1&/item&
&item&2&/item&
&item&3&/item&
&item&(&/item&
&item&/&/item&
&item&0&/item&
&item&00&/item&
&item&.&/item&
&item&)&/item&
&item&=&/item&
&/string-array&
44 &/resources&
  接下来得注意,定义了字串资源文件后,对组件的文本进行设置可以在xml布局文件中,也可以在Java代码中。虽然常见的也较符合常理的做法是在xml文件中利用android:text="@string/xxx"进行设置,但是针对本文介绍的计算器而言,在Java代码中进行设置更为方便。结合TableLayout和TableRow的特性,来看看怎样快速地对左右按钮进行本文的设置。
1 package com.dylan_wang.
3 import android.app.A
4 import android.os.B
5 import android.view.M
6 import android.view.MenuI
7 import android.widget.B
8 import android.widget.TableL
9 import android.widget.TableR
11 public class ActivityCalculator extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calculator);
String[] stringsCalculator = getResources().getStringArray(R.array.strings_calculator);
TableLayout tableLayout = (TableLayout)findViewById(R.id.tablelayout_calculator);
for(int i=1;i&tableLayout.getChildCount();++i){
TableRow tableRow = (TableRow)tableLayout.getChildAt(i);
for(int j=0;j&tableRow.getChildCount();++j){
Button button = (Button)tableRow.getChildAt(j);
button.setText(stringsCalculator[(i-1)*5+j]);
public boolean onCreateOptionsMenu(Menu menu) {
// I this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
return super.onOptionsItemSelected(item);
  可以看到,真正只用了9行代码(18-26)就完成了30个按钮的本文获取与设置。当然,如果在各行按钮之间穿插其他组件的话,得分情况处理。
  从界面示意图可以看出,乘除号分别是*与/,并不是理想中的&与&。那么对于&(pi,53行)、&(sqrt,130行)这种特殊字符对应编码去哪找,乘除号(&与&)又该怎么输入呢?
  对于前者,有一个总结得比较齐全的网站,是咱们博客园中的同志贡献的,供大家参考。
  而对于乘除号这类符号靠输入法+细心就能搞定了,相信平时大家在中文p拼音模式下(有时英文也会出现)输入一些中文字的部分或全部字符时一定看到过,输入法提示框中会出现额外的数学符号。如在百度输入chu,会出现以下提示框:
输入ch,竟然乘除号都出来了:
若是输入cheng,则没有想象中的&出现:
  当然,不同电脑及输入法会有差异,但不出意外的话该方法是能够帮助我们获取到想要的符号的。
  将乘除号设置为&、&,并将清零与回删按钮标记为红色后的界面如下:
  至此只是完成了一款计算器粗略的界面设计部分,后续会慢慢对各按钮对应的功能进行实现,有必要也会对界面进行完善。
  最后分享一个感觉不错的png等图标获取网站,如果直接打开有问题,也可以直接度娘easyicon。
  欢迎讨论,觉得有用且对后续实现感兴趣的朋友帮忙点个赞哦^_^
阅读(...) 评论()√tan²30°-2tan30°+1怎么解?
√tan²30°-2tan30°+1怎么解?
√tan²30°-2tan30°+1=√(tan30°-1)²=1-tan30°=1-√3/3 再问: 谢谢,明白了。 再答: 第一步是完全平方公式, 第二步是,开根号后结果必须是正的。
我有更好的回答:
剩余:2000字
与《√tan²30°-2tan30°+1怎么解?》相关的作业问题
解√(tan²30-2tan30+1)+|cos30-1|=√(tan30-1)²+|cos30-1|=|tan30-1|+|cos30-1|=1-tan30+1-cos30=1-√3/3+1-√3/2=2-5√3/6
tan²30°+tan²60—2tan30°tan60°=(tan30°-tan60°)²所以,原式=√(tan30°-tan60°)²=tan60°-tan30°=√3-√3/3=2√3/3
根号下(tan^2 30°-2tan30°+1) +│cos30°-1│=根号下(tan 30°-1)^2 +│cos30°-1│=1-tan 30° +1-cos30°=2-tan 30° -cos30°=2-√3/3-√3/2=2-5√3/6
tan690°=tan(720°-30°)=tan(-30°)=-tan30°=-(√3)/3 再问: 是否能举个例子? 再答: 诱导公式 tan(k*180°+a) k∈Z =tana 这里,k=4再问: 再问: 请问这题该怎么解? 再答: 再问: 再问: 请问二三两题怎么解
① * ÷ ( 8 / 12 ) = 3 / 5∴ * = ( 3 / 5 ) × ( 8 / 12 )= 2 / 5② ( 7* ) ÷ ( 1 / 3 ) = 3 / 5∴ * = ( 3 / 5 ) × ( 1 / 3 ) × ( 1 / 7 )= 1 / 35③ ( 30 / 7 ) ÷ * = 18∴ * =
img class="ikqb_img" src="http://c.hiphotos.baidu.com/zhidao/wh%3D600%2C800/sign=ec93d07a706f1af0dd4e4/8c3f96d12f2e9586.jpg"
可以求得∠A=60°,∠B=30°∴c=2b,a=√(c²-b²)=√3b∴√3b-b=2,解得b=2/(√3-1)=√3+1∴a=√3b=3+√3,c=2b=2√3+2
从地理布局来看,沿着北纬30°线,既有地球山脉的最高峰珠穆朗玛峰,又有海底最深处马里亚纳海沟.世界几大河流--埃及的尼罗河、伊拉克的幼发拉底河、中国的长江、美国的密西西比河,均是在这一纬度线入海. 这里也是世界上许多著名的自然之谜及古文明所在地:古埃及金字塔群,狮身人面像,北非撒哈拉沙漠的"火神火种"壁画,死海,巴比伦
(x+3)(3-0.5x)=10=3x+9-0.5x平方-1.5x-10=1.5x-0.5x平方-1=15x-5x平方-10=5(3x-x平方-2)
0.5x-0.3=19x=193/5
30%为0.3也就是3/10(x-2/5+14-x)/x=3/10(2/5+14)/x=3/10x=3/144
x=100×2-30=170
2x+[24-x]0.8=302x+19.2-0.8x=302x-0.8x=30-19.21.2x=10.8x=10.8÷1.2x=9
5:8=x:308*x=5*308*x=150x=18.75
2X+1.92-0.8X=301.2X=28.08X=23.4.
(20 )是方程30%X=6的解前面不是方程 再问: 在4,20,6又1/2,1.8这四个数中,( )是方程2分之1+X=7的解 再答: (6又1/2 )是方程2分之1+X=7的解再问: 5个相邻的自然的和是a,其中最大的自然数是( )。
利用的是两角和的正切公式.证明:右边=tan(α+β)(1-tanα*tanβ) =[(tanα + tanβ)/(1- tanα*tanβ)](1-tanα*tanβ) =tanα + tanβ =左边所以等式得证.
第一个是(1+30%)x=260吧(1+30%)x=260130%x=260x×130%÷130%=260÷130%x=2009分之7-660x=6分之1-660x=3/18-14/18-660x=-11/18x×660÷660=11/18÷660x=1/10805分之1x+3分之2x=30分之133/15x+10/125K1,240 条评论分享收藏感谢收起tianxun.com)skyscanner在中国叫做天巡,是预订国际机票必备搜索引擎之一。订票的时候会链接去代理商及航空公司官网,有很友好的中文界面并且能够直接显示人民币价格。可以在天巡关注某些航线的价格趋势,设置价格提醒,每天都会有邮件提醒你价格波动。优点是对于英文没那么好的网友比较适合。PRICELINE( )PRICELINE是目前美国最大的在线旅游公司。在PRICELINE网站,最直观的可选项目就是机票、酒店、租车、旅游保险,机票价格偏贵。但是如果临时决定出行,可以尝试他家的bid your price,这个功能支持你输入一个比较低的报价,系统会自动征询所有的航空公司。如果有航空公司愿意接受这个报价 ,就赚到了。这个网站还有一个独特的功能,就是能帮你组合两个不同航空公司的航班,让你买到比正常情况便宜的转机机票。不过订这种票需要考虑好转机时间及行李提取的问题,避免因飞机延误造,转机时间不够等造成不必要的麻烦。 STUDENTUNIVERSE(
)这是一个针对学生机票的搜索引擎(要有.edu的邮箱并小于35岁)。大部分情况下它不会比下面要介绍的KAYAK便宜,但有时候推出的学生机票便宜的惊人。KAYAK( )在你只确定了大概出行时间却不知道去哪里的时候,KAYAK就体现出它的优势,只要输入出发地和大概时间,就会帮你按月份罗列出从你出发地出发的最便宜的机票。LASTMINUTE() 就像它的名字,这个网站是那些不到起飞前不买机票的拖延症患者的救命稻草。但是早动手才是王道,毕竟这种说走就走的事还是有一定风险的。   好了,基本就是这些了。其实并不建议大家花费太多时间在订机票上,毕竟如果是出去玩,你更应该花心思在“玩什么”上面。大部分中国旅行者,还是停留在用几天时间比对机票酒店,然后看一堆长得很像的攻略就走的状态。与省机票钱相比,找到特别的旅行体验并提前完成预订(省去到当地比价和选择)在我看来更为实用和有价值。这也是我为什么在做KLOOK旅行的原因,在路上通过参与户外、文化、美食、步行游等活动探索更多元的旅行体验。近况汇报:两年时间,团队从十人到近百人,在深圳香港台北新加坡开设office,去年完成经纬领投A轮。创业维艰,头发和颜值哗哗的掉,只希望每一个中国人都可以借助 ,玩得更丰富更深入。————————————————知乎专栏:,做最会玩的集体专栏,欢迎有专栏权限的旅行者加入我们,也欢迎大家投稿,每个人都可以是Travel Curator。赞同 6.2K162 条评论分享收藏感谢收起扫二维码下载作业帮
3亿+用户的选择
下载作业帮安装包
扫二维码下载作业帮
3亿+用户的选择
下列式子:①.tan25°﹢tan35°﹢tan25°tan35°②.﹙1﹢tan20°﹚﹙1﹢tan40°﹚③.﹙1﹢tan15°﹚/﹙1-tan15°﹚④.tan30°/﹙1-tan²30°﹚.其中结果为根号3的是( )
作业帮用户
扫二维码下载作业帮
3亿+用户的选择
不好意思啊
参考答案是①③ 怎么回事
①.tan25°﹢tan35°﹢tan25°tan35°
=(1-tan25°tan35°)*tan60°+tan25°tan35°
=√3+(1-√3)tan25°tan35°
我算出来是这样的。
为您推荐:
其他类似问题
不好意思啊
参考答案是①③ 怎么回事
①.tan25°﹢tan35°﹢tan25°tan35°
=(1-tan25°tan35°)*tan60°+tan25°tan35°
=√3+(1-√3)tan25°tan35°
我算出来是这样的。
③.﹙1﹢tan15°﹚/﹙1-tan15°﹚=﹙tan45º﹢tan15°﹚/﹙1-tan45ºtan15°﹚=tan﹙45º+15º﹚=tan60º=√3
不好意思啊
参考答案是①③ 怎么回事
扫描下载二维码扫二维码下载作业帮
3亿+用户的选择
下载作业帮安装包
扫二维码下载作业帮
3亿+用户的选择
sin10º,sin20º,sin30º,sin35º.和cos,tan,如何算.如sin80°=0.9848
作业帮用户
扫二维码下载作业帮
3亿+用户的选择
sin80=0.9848cos80=√(1-sin²80)=0.1736sin10=sin(90-80)=cos80=0.1736cos10=sin80=0.9848sin20=2sin10cos10=2*0.6=0.3419cos20=√(1-sin²20)=0.9397sin30=0.5.依次类似
为您推荐:
其他类似问题
扫描下载二维码}

我要回帖

更多关于 tan20 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信