首页 > 编程技术 > android

联想a65手机怎么获取ROOT权限

发布时间:2016-9-20 19:59

本文章来给大家介绍利用z4root工具快速来给你手机获取ROOT权限的操作方法,有需要了解的朋友可进入参考。

1,首页为手机安装驱动,如果你没有驱动软件可以在本站下载。(安装驱动后如果手机无法链接上电脑,请打开手机的USB调试,
步骤如下:设置——选择应用程序-——开发;)

2,2、手机关机;

3、按住音量下键+菜单键(最左边)再按住电源键。开机后不要马上松手等待5-10秒,这时开机界面会停留在开机第一屏。

4、松手,插入USB线,进入你指定工具所在的硬盘位置双击打开附件解压后得到的ROOT工具A65-Tools-v2.exe;

 
5、选择 1 后按回车键,完成后会自动重启手机;

root后重启后查看手机菜单是否有“授权管理(superuser)”或“超级用户”,如果有,那恭喜你,ROOT成功了~~如果没有,请多试几次,我就试了三次才成功的

最近开始学Android开了,但是在我在Android手机无法调试时出现Device HT843KV11551 requires that applications explicitely declare themselves as debuggable in their manifest. Application \'com.test\' does not have the attribute debuggable set to TRUE in its manifest and cannot be debugged.了,下面我记录一下。

错误提示

Device 'HT843KV11551' requires that applications explicitely declare themselves as debuggable in their manifest.

Application 'com.test' does not have the attribute 'debuggable' set to TRUE in its manifest and cannot be debugged.

解决办法

Android.manifest 文件中添加Debug项目,在可视化界面选择application选项卡然后将Debugable的值设置为true

点击查看原图

编辑源码的添加方式则是在<application 字段中增加一个属性:android:debuggable="true"

在Android中要让一个程序的界面始终保持一个方向,不随手机方向转动而变化的办法: 只要在AndroidManifest.xml里面配置一下就可以了,小编来给大家介绍一款Android禁止横屏竖屏切换程序代码,有需要了解的同学可参考

在AndroidManifest.xml的activity(需要禁止转向的activity)配置中加入android:screenOrientation="landscape"属性即可(landscape是横向,portrait是竖屏)。例如:

 代码如下 复制代码

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.ray.linkit"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Main"
                  android:label="@string/app_name"
                  android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
                <activity android:name=".GamePlay"
                android:screenOrientation="portrait"></activity>
                <activity android:name=".OptionView"
                android:screenOrientation="portrait"></activity>
    </application>
    <uses-sdk android:minSdkVersion="3" />
</manifest>

另外,android中每次屏幕方向切换时都会重启Activity,所以应该在Activity销毁前保存当前活动的状态,在Activity再次Create的时候载入配置,那样,进行中的游戏就不会自动重启了!

要避免在转屏时重启activity,可以通过在androidmanifest.xml文件中重新定义方向(给每个activity加上android:configChanges=”keyboardHidden|orientation”属性),并根据Activity的重写onConfigurationChanged(Configuration newConfig)方法来控制,这样在转屏时就不会重启activity了,而是会去调用onConfigurationChanged(Configuration newConfig)这个回调方法。例如

 代码如下 复制代码

if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){
  //横屏
  setContentView(R.layout.file_list_landscape);
}else{
  //竖屏
   setContentView(R.layout.file_list);
}

需要注意的是如果你的横竖屏布局不一样,那么使用onConfigurationChanged会导致切换之后布局没有变化,所以该设置慎用为好。
.

本文章来给大家介绍Android中Bitmap和Drawable用法详解,有需要了解的同学可进入参考。

一、相关概念
1、Drawable就是一个可画的对象,其可能是一张位图(BitmapDrawable),也可能是一个图形(ShapeDrawable),还有可能是一个图层(LayerDrawable),我们根据画图的需求,创建相应的可画对象2、Canvas画布,绘图的目的区域,用于绘图3、Bitmap位图,用于图的处理4、Matrix矩阵二、Bitmap
1、从资源中获取Bitmap

Resources res = getResources();
Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.icon);

2、Bitmap → byte[]

 代码如下 复制代码

public byte[] Bitmap2Bytes(Bitmap bm) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
    return baos.toByteArray();
}

3、byte[] → Bitmap

 代码如下 复制代码

public Bitmap Bytes2Bimap(byte[] b) {
    if (b.length != 0) {
        return BitmapFactory.decodeByteArray(b, 0, b.length);
    } else {
        return null;
    }
}

Bitmap缩放

 代码如下 复制代码

public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height) {
    int w = bitmap.getWidth();
    int h = bitmap.getHeight();
    Matrix matrix = new Matrix();
    float scaleWidth = ((float) width / w);
    float scaleHeight = ((float) height / h);
    matrix.postScale(scaleWidth, scaleHeight);
    Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
    return newbmp;
}

5、将Drawable转化为Bitmap

 代码如下 复制代码

public static Bitmap drawableToBitmap(Drawable drawable) {
        // 取 drawable 的长宽
        int w = drawable.getIntrinsicWidth();
        int h = drawable.getIntrinsicHeight();
        // 取 drawable 的颜色格式
        Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
                : Bitmap.Config.RGB_565;
        // 建立对应 bitmap
        Bitmap bitmap = Bitmap.createBitmap(w, h, config);
        // 建立对应 bitmap 的画布
        Canvas canvas = new Canvas(bitmap);
        drawable.setBounds(0, 0, w, h);
        // 把 drawable 内容画到画布中
        drawable.draw(canvas);
        return bitmap;
    }


public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) {
    int w = bitmap.getWidth();
    int h = bitmap.getHeight();
    Bitmap output = Bitmap.createBitmap(w, h, Config.ARGB_8888);
    Canvas canvas = new Canvas(output);
    final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, w, h);
    final RectF rectF = new RectF(rect);
    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);
    canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);
    return output;
}


6、获得圆角图片

 代码如下 复制代码

public static Bitmap createReflectionImageWithOrigin(Bitmap bitmap) {
    final int reflectionGap = 4;
    int w = bitmap.getWidth();
    int h = bitmap.getHeight();
    Matrix matrix = new Matrix();
    matrix.preScale(1, -1);
    Bitmap reflectionImage = Bitmap.createBitmap(bitmap, 0, h / 2, w,
            h / 2, matrix, false);
    Bitmap bitmapWithReflection = Bitmap.createBitmap(w, (h + h / 2),
            Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmapWithReflection);
    canvas.drawBitmap(bitmap, 0, 0, null);
    Paint deafalutPaint = new Paint();
    canvas.drawRect(0, h, w, h + reflectionGap, deafalutPaint);
    canvas.drawBitmap(reflectionImage, 0, h + reflectionGap, null);
    Paint paint = new Paint();
    LinearGradient shader = new LinearGradient(0, bitmap.getHeight(), 0,
            bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff,
            0x00ffffff, TileMode.CLAMP);
    paint.setShader(shader);
    // Set the Transfer mode to be porter duff and destination in
    paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
    // Draw a rectangle using the paint with our linear gradient
    canvas.drawRect(0, h, w, bitmapWithReflection.getHeight()
            + reflectionGap, paint);
    return bitmapWithReflection;
}

三、Drawable

 代码如下 复制代码

Bitmap bm=xxx; //xxx根据你的情况获取
BitmapDrawable bd= new BitmapDrawable(getResource(), bm);
因为BtimapDrawable是Drawable的子类,最终直接使用bd对象即可。

2、Drawable缩放

 代码如下 复制代码

public static Drawable zoomDrawable(Drawable drawable, int w, int h) {
    int width = drawable.getIntrinsicWidth();
    int height = drawable.getIntrinsicHeight();
    // drawable转换成bitmap
    Bitmap oldbmp = drawableToBitmap(drawable);
    // 创建操作图片用的Matrix对象
    Matrix matrix = new Matrix();
    // 计算缩放比例
    float sx = ((float) w / width);
    float sy = ((float) h / height);
    // 设置缩放比例
    matrix.postScale(sx, sy);
    // 建立新的bitmap,其内容是对原bitmap的缩放后的图
    Bitmap newbmp = Bitmap.createBitmap(oldbmp, 0, 0, width, height,
            matrix, true);
    return new BitmapDrawable(newbmp);
}

本文章来给大家介绍Android RelativeLayout 属性用法详解,有需要了解RelativeLayout 属性的同学可进入参考参考。

// 相对于给定ID控件

 代码如下 复制代码

android:layout_above 将该控件的底部置于给定ID的控件之上;

android:layout_below 将该控件的底部置于给定ID的控件之下;

android:layout_toLeftOf    将该控件的右边缘与给定ID的控件左边缘对齐;

android:layout_toRightOf  将该控件的左边缘与给定ID的控件右边缘对齐;

android:layout_alignBaseline  将该控件的baseline与给定ID的baseline对齐;

android:layout_alignTop        将该控件的顶部边缘与给定ID的顶部边缘对齐;

android:layout_alignBottom   将该控件的底部边缘与给定ID的底部边缘对齐;

android:layout_alignLeft        将该控件的左边缘与给定ID的左边缘对齐;

android:layout_alignRight      将该控件的右边缘与给定ID的右边缘对齐;

// 相对于父组件

android:layout_alignParentTop      如果为true,将该控件的顶部与其父控件的顶部对齐;

android:layout_alignParentBottom 如果为true,将该控件的底部与其父控件的底部对齐;

android:layout_alignParentLeft      如果为true,将该控件的左部与其父控件的左部对齐;

android:layout_alignParentRight    如果为true,将该控件的右部与其父控件的右部对齐;

// 居中

android:layout_centerHorizontal 如果为true,将该控件的置于水平居中;

android:layout_centerVertical     如果为true,将该控件的置于垂直居中;

android:layout_centerInParent   如果为true,将该控件的置于父控件的中央;

// 外部间隔

android:layout_marginTop       上偏移的值;

android:layout_marginBottom  下偏移的值;

android:layout_marginLeft   左偏移的值;

android:layout_marginRight   右偏移的值;

RelativeLayout代码

 代码如下 复制代码

RelativeLayout relativeLayout = new RelativeLayout(context);
  Spinner spinner = new Spinner(context);
  edit_text_add_country = new AutoCompleteTextView(context);
  edit_text_add_stock = new EditText(this);
  RadioGroup containCountry = new RadioGroup(context);
 
 
  spinner.setId(1);
  edit_text_add_country.setId(2);
  edit_text_add_stock.setId(3);
  containCountry.setId(4);
 
  String[] mCountries = { "China" , "USA", "China2", "Comunicate"};
  List<String> allcountries = new ArrayList<String>();
  ArrayAdapter<String> aspnCountries;
 
  for (int i = 0; i < mCountries.length; i++) {
   allcountries.add(mCountries[i]);
  }
 
  aspnCountries = new ArrayAdapter<String>(this,
    android.R.layout.simple_spinner_item, allcountries);
  aspnCountries
    .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(aspnCountries);
  edit_text_add_country.setAdapter(aspnCountries);
  edit_text_add_country.setHint("input country name");
  edit_text_add_stock.setHint("input stock name");
 
  RelativeLayout.LayoutParams param1, param2, param3;
  param1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  param2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  param2.addRule(RelativeLayout.BELOW, 1);
  param3 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  param3.addRule(RelativeLayout.BELOW, 4);
  ViewGroup.LayoutParams param4, param5;
  param4 = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  param5 = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
 
  containCountry.addView(spinner,param4);
  containCountry.addView(edit_text_add_country, param5);
 
  relativeLayout.addView(containCountry, param1);
  relativeLayout.addView(edit_text_add_stock, param3);
 
  builder.setView(relativeLayout);

看个实例

RelativeLayout代码实现及点击设置

 代码如下 复制代码

public class Main extends Activity {
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
      
        ArrayList<Person> personList = new ArrayList<Person>();
        personList.add(new Person("zwx","23"));
        personList.add(new Person("zwx1","24"));
        personList.add(new Person("zwx2","25"));
      
        LinearLayout ll = (LinearLayout)findViewById(R.id.LinearLayout01);


        for(Person person : personList){
         RelativeLayout rl = new RelativeLayout(this);
         RelativeLayout.LayoutParams  rll = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
          rl.setLayoutParams(rll);


          TextView tv1 = new TextView(this);
          RelativeLayout.LayoutParams tv1_rl = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
          tv1_rl.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
          tv1.setText(person.getName());
          rl.addView(tv1, tv1_rl);
        
          TextView tv2 = new TextView(this);
          RelativeLayout.LayoutParams tv2_rl = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
          tv2_rl.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
          tv2.setText(person.getAge());
          rl.addView(tv2, tv2_rl);


          ll.addView(rl);
          rl.setOnClickListener(new View.OnClickListener() {
    
                @Override
              public void onClick(View v) {
                   Toast.makeText(Main.this, "11", 5000).show();
                }
               }) ;
        }
    }
}


注意:不能在RelativeLayout容器本身和他的子元素之间产生循环依赖,比如说,不能将RelativeLayout的高设置成为WRAP_CONTENT的时候将子元素的高设置成为ALIGN_PARENT_BOTTOM。

标签:[!--infotagslink--]

您可能感兴趣的文章: