當前位置:首頁 » 安卓系統 » android弧度

android弧度

發布時間: 2022-07-08 02:45:41

1. 安卓科學計算器如何計算正餘弦

安卓自帶的計算器默認按弧度計算。
比如計算30°的正弦:
sin(30/180*π)=

2. android自定義shape 時xmlns怎麼自動

MainActivity如下:
package cn.testshape;
import android.os.Bundle;
import android.app.Activity;
/**
* Demo描述:
* 自定義shape的使用
*/
public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}

}

main.xml如下:
<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"
>

<Button
android:layout_width="250dip"
android:layout_height="50dip"
android:text="測試自定義shape的使用"
android:background="@drawable/background_selector"
android:textColor="@drawable/textcolor_selector"
android:layout_centerInParent="true"
android:gravity="center"
/>

</RelativeLayout>

background_selector.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/pressed_shape" android:state_pressed="true"/>
<item android:drawable="@drawable/default_shape"/>
</selector>

default_shape.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- 定義矩形rectangle -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<!-- 定義邊框顏色 -->
<solid android:color="#d1d1d1" />
<!-- 定義圓角弧度 -->
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp"
/>

</shape>

pressed_shape.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- 定義矩形rectangle -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<!-- 定義邊框顏色 -->
<solid android:color="#7bb3f8" />
<!-- 定義圓角弧度 -->
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp"
/>

</shape>

textcolor_selector.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:color="#ffffff" android:state_pressed="true"/>
<item android:color="#000000"/>
</selector>

3. android 彈窗中我的背景圖是有弧度的,為什麼做出來的彈窗是有角的 ,要怎麼寫代碼去掉稜角

整個彈出窗口的背景放一張圓角圖片就好了。。

4. 安卓系統的手機計算器,sin30,cos30等計算都不對,不知道怎麼回事 有誰會用

這種計算器默認的是弧度制,30°是角度制,進行角度與弧度轉化即可:
以30°為例,180°=1π rad,則1°=(1/180)π rad,那麼30°=(1/6)π rad。
用π/6代替你的30進行計算即可。

5. android自定義對話框怎麼設置弧度

我想你想要實現圓角的對話框,可以參考如下:

package com.example.jjy.myapplication;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by jjy on 16-5-15.
*/
public class MyDialog extends Dialog{
private Button positiveButton, negativeButton;
private TextView contenttv;

public MyDialog(Context context) {
super(context,R.style.mydialog);
View view = LayoutInflater.from(getContext()).inflate(R.layout.mydialoglayout, null); //通過LayoutInflater獲取布局
contenttv = (TextView) view.findViewById(R.id.title);
positiveButton = (Button) view.findViewById(R.id.acceptbtn);
negativeButton = (Button) view.findViewById(R.id.refusebtn);
setContentView(view); //設置view
}
//設置內容
public void setContent(String content) {
contenttv.setText(content);
}
//確定按鈕監聽
public void setOnPositiveListener(View.OnClickListener listener){
positiveButton.setOnClickListener(listener);
}

//否定按鈕監聽
public void setOnNegativeListener(View.OnClickListener listener){
negativeButton.setOnClickListener(listener);
}
}

R.style.mydialog 對話框屬性在 values/styles.xml中設置:

[html] view plain
<resources>
<style name="mydialog" parent="android:style/Theme.Dialog">
<!-- 背景透明 -->
<item name="android:windowBackground">@android:color/transparent</item>
<!-- 沒有標題 -->
<item name="android:windowNoTitle">true</item>
<!-- 背景模糊 -->
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>

6. android 怎麼計算一個弧度起點 和 結束點

最小變動 乘以 交易單位 乘以 交易數量.如黃金期貨, 0.01 * 1000*1= 10, 當黃金期貨變動0.01點時,獲利10元. 0.01 為變動, 1000克 為黃金期貨交易的單位(1000克為1手), 1為手數-這個是黃金最小的買進量.同理 大豆期貨, 1*10*1=10 元,當大豆期貨變動1元, 1手大豆合約 獲利10元.

所謂黃金期貨,是指以國際黃金市場未來某時點的黃金價格為交易標的的期貨合約,投資人買賣黃金期貨的盈虧,是由進場到出場兩個時間的金價價差來衡量,契約到期後則是實物交割。

7. android 使用canvas畫線,如何保證快速畫出圓滑的曲線

[mw_shl_code=java,true] RectF rect = new RectF(0, 0, radii, radii); // 圓形弧度需要的區域(左上角的x,y坐標 ,及右下角x,y坐標) Paint paint = new Paint(); paint.setColor(r.getColor(R.color.bg_color_1)); canvas.drawCircle(radii/2, radii/2, radii/2, paint);[/mw_shl_code]

8. 怎樣讓edittext有弧角

實現弧角,需要編寫一個樣式文件,然後edittext的background使用該樣式就可以了。弧角的弧度可以通過修改android:radius來變化。

-----------------------效果圖-----------------------

---------------------代碼------------------------------

<EditText
android:id="@+id/sendMsg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:background="@drawable/style_edittext_shape"
android:hint="需要發送的內容"
android:inputType="text" />

---------------------樣式style_edittext_shape.xml文件------------------------

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的顏色 -->
<!-- <solid android:color="#F0F3F0" /> -->
<!-- 設置按鈕的四個角為弧形 -->
<!-- android:radius 弧形的半徑 -->
<corners android:radius="15dip" />
<stroke
android:width="1dip"
android:color="#BDC7D8" />

<!-- padding:Button裡面的文字與Button邊界的間隔 -->
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
</shape>

-------------------------END-----------------------

9. Android studio中怎麼將方形按鈕設置成圓角以及漸變效果

一、在 studio中res 包下的drawable中建立一個shape的文件,系統會給你一個默認的方形然後你就可以開始設置你需要的效果。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:Android="http://schemas.android.com/apk/res/android">

<!--填充背景色 -->
<solid android:color="#ffff00" /> //solid 指的是背景顏色的設置

<!--描邊 他需要 2個參數,顏色 第二參數 寬度 -->
<stroke
android:width="2dp" //width 指的是邊框的寬度
android:color="#ff00ff" /> //color指的是邊框的顏色

<!-- 設置弧度 Radius設置所有角的弧度 --> //radius 指的就是角的弧度
<corners //方形存在四個角,我們可以同時設置四個角,也可以分開設置
android:bottomLeftRadius="20dp" //左下角
android:bottomRightRadius="20dp" //右下角
android:topLeftRadius="20dp" //左上角
android:topRightRadius="20dp" /> //右上角

//同時設置:<corners
android:Radius="20dp" /> //四個角同時設置

<!-- 漸變色 startColor 啟示顏色 endColor最終顏色 type類型(如果類型為radial(徑向漸變,一個圓心以半徑的方式漸變),必須加上 android:gradientRadius="**")-->
<gradient
android:startColor="#ff0000" //開始顏色
android:endColor="#ffffff" //結束顏色
android:type="linear" /> //水平漸變 從左到右 type 指的是漸變的模式

<!--內容與邊框的間距-->
<padding
android:bottom="15dp"
android:left="15dp"
android:right="15dp"
android:top="15dp" />

<!--如果設置了漸變色 那麼背景顏色將不顯示 -->

</shape>
<gradient>
shape的顏色漸變屬性
attributes:

android:angle
Integer,代表漸變顏色的角度, 0 is left to right, 90 is bottom to top. 必須是45的整數倍.
默認是 0.該屬性只有在type=linear情況下起作用,默認的type為linear。
默認情況下,從左到右:

xml代碼:<gradient
android:startColor="#000000"
android:endColor="#ffffff"
/>

angle=270,從上到下 :

xml代碼:<gradient
android:startColor="#000000"
android:endColor="#ffffff"
android:angle="270"
/>
android:startColor
Color. 顏色漸變的開始顏色,如angle=270中的 android:startColor="#000000"
android:endColor
Color. 顏色漸變的結束顏色,如angle=270中的 android:endColor="#ffffff"
android:centerColor
Color. 顏色漸變的中間顏色,主要用於多彩。

<gradient
android:startColor="#000000"
android:endColor="#ffffff"
android:centerColor="#ff0000"
/>
android:centerX
Float.(0 - 1.0) 相對X的漸變位置。
android:centerY
Float.(0 - 1.0) 相對Y的漸變位置。
這兩個屬性只有在type不為linear情況下起作用。
android:gradientRadius
Float. 漸變顏色的半徑,單位應該是像素點. 需要 android:type="radial".
如果android:type="radial",沒有設置android:gradientRadius,將會報錯,error inflating class.

xml代碼:
<gradient
android:startColor="#ff0000"
android:endColor="#ffffff"
android:centerX="0.5"
android:centerY="0.5"
android:gradientRadius="30"
android:type="radial"
/>
加入Android:centerColor屬性

<gradient
android:startColor="#ff0000"
android:endColor="#ffffff"
android:centerColor="#000000"
android:centerX="0.5"
android:centerY="0.5"
android:gradientRadius="30"
android:type="radial"
/>
android:type
Value Description
"linear" 線性漸變.可以理解為 y=kx+b.
"radial" A radial gradient.圓形漸變,起始顏色從cenralX,centralY點開始。
"sweep" A sweeping line gradient.

centerX="0.2" centerX="0.2"

xml代碼:
<gradient
android:startColor="#ff0000"
android:endColor="#ffffff"
android:centerX="0.2"
android:centerX="0.2"
android:gradientRadius="30"
android:type="radial"
/>
type="sweep":

xml代碼:
<gradient
android:startColor="#ff0000"
android:endColor="#ffffff"
android:centerX="0.5"
android:centerY="0.5"
android:type="sweep"
/>

熱點內容
scratch少兒編程課程 發布:2025-04-16 17:11:44 瀏覽:619
榮耀x10從哪裡設置密碼 發布:2025-04-16 17:11:43 瀏覽:347
java從入門到精通視頻 發布:2025-04-16 17:11:43 瀏覽:62
php微信介面教程 發布:2025-04-16 17:07:30 瀏覽:288
android實現陰影 發布:2025-04-16 16:50:08 瀏覽:781
粉筆直播課緩存 發布:2025-04-16 16:31:21 瀏覽:334
機頂盒都有什麼配置 發布:2025-04-16 16:24:37 瀏覽:197
編寫手游反編譯都需要學習什麼 發布:2025-04-16 16:19:36 瀏覽:791
proteus編譯文件位置 發布:2025-04-16 16:18:44 瀏覽:350
土壓縮的本質 發布:2025-04-16 16:13:21 瀏覽:578